aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/namelist_4.f90
blob: 538bceaa4b6160b739954eaa6268a0c00c2ae3c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
! { dg-do compile }
! This tests the fix for PR25089 in which it was noted that a
! NAMELIST member that is an internal(or module) procedure gave
! no error if the NAMELIST declaration appeared before the
! procedure declaration. Not mentioned in the PR is that any
! reference to the NAMELIST object would cause a segfault.
!
! Based on the contribution from Joost VanderVondele
!
module M1
CONTAINS
! This is the original PR
  INTEGER FUNCTION G1()
    NAMELIST /NML1/ G2 ! { dg-error "PROCEDURE attribute conflicts" }
    G1=1
  END FUNCTION
  INTEGER FUNCTION G2()
    G2=1
  END FUNCTION
! This has always been picked up - namelist after function
  INTEGER FUNCTION G3()
    NAMELIST /NML2/ G1 ! { dg-error "PROCEDURE attribute conflicts" }
    G3=1
  END FUNCTION
END module M1
 
program P1
CONTAINS
! This has the additional wrinkle of a reference to the object.
  INTEGER FUNCTION F1()
    NAMELIST /NML3/ F2 ! { dg-error "PROCEDURE attribute conflicts" }
! Used to ICE here
    f2 = 1             ! { dg-error "is not a VALUE" }
    F1=1
  END FUNCTION
  INTEGER FUNCTION F2()
    F2=1
  END FUNCTION
END