OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / alloc_comp_assign_5.f90
1 ! { dg-do run }
2 ! { dg-options "-O2" }
3 ! Tests the fix for PR29428, in which the assignment of
4 ! a function result would result in the function being
5 ! called twice, if it were not a result by reference,
6 ! because of a spurious nullify in gfc_trans_scalar_assign.
7 !
8 ! Contributed by Paul Thomas  <pault@gcc.gnu.org>
9 !
10 program test
11 implicit none
12
13   type A
14     integer, allocatable :: j(:)
15   end type A
16
17   type(A):: x
18   integer :: ctr = 0
19
20   x = f()
21
22   if (ctr /= 1) call abort ()
23
24 contains
25
26   function f()
27     type(A):: f
28       ctr = ctr + 1
29       f = A ((/1,2/))
30   end function f
31
32 end program
33