PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / init_flag_10.f90
blobdac9418d614b1c1b9c19be95aff163258712affd
1 ! { dg-do run }
2 ! { dg-options "-finit-real=NAN" }
3 ! { dg-add-options ieee }
4 ! { dg-skip-if "NaN not supported" { spu-*-* } }
6 ! PR fortran/50619
8 ! Contributed by Fred Krogh
10 ! The NaN initialization used to set the associate name to NaN!
13 module testa2
14 type, public :: test_ty
15 real :: rmult = 1.0e0
16 end type test_ty
18 contains
19 subroutine test(e, var1)
20 type(test_ty) :: e
21 real :: var1, var2 ! Should get NaN initialized
23 ! Should be the default value
24 if (e%rmult /= 1.0) call abort ()
26 ! Check that NaN initialization is really turned on
27 if (var1 == var1) call abort ()
28 if (var2 == var2) call abort ()
30 ! The following was failing:
31 associate (rmult=>e%rmult)
32 if (e%rmult /= 1.0) call abort ()
33 end associate
34 end subroutine test
35 end module testa2
37 program testa1
38 use testa2
39 type(test_ty) :: e
40 real :: var1 ! Should get NaN initialized
41 call test(e, var1)
42 stop
43 end program testa1