Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/gfortran.dg/class_1.f03 @ 144:8f4e72ab4e11
fix segmentation fault caused by nothing next cur_op to end
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 23 Dec 2018 21:23:56 +0900 |
parents | 84e7813d76e9 |
children |
rev | line source |
---|---|
111 | 1 ! { dg-do run } |
2 ! | |
3 ! PR 40940: CLASS statement | |
4 ! | |
5 ! Contributed by Janus Weil <janus@gcc.gnu.org> | |
6 | |
7 implicit none | |
8 | |
9 type t | |
10 integer :: comp | |
11 class(t),pointer :: c2 | |
12 end type | |
13 | |
14 class(t),pointer :: c1 | |
15 | |
16 allocate(c1) | |
17 | |
18 c1%comp = 5 | |
19 c1%c2 => c1 | |
20 | |
21 print *,c1%comp | |
22 | |
23 call sub(c1) | |
24 | |
131 | 25 if (c1%comp/=5) STOP 1 |
111 | 26 |
27 deallocate(c1) | |
28 | |
29 contains | |
30 | |
31 subroutine sub (c3) | |
32 class(t) :: c3 | |
33 print *,c3%comp | |
34 end subroutine | |
35 | |
36 end | |
37 |