nncarlson / gfortran.dg

The GFortran testsuite rigged for testing other Fortran compilers
7 stars 2 forks source link

Illegal procedure pointer in common in proc_ptr_common_1.f90 #5

Closed nncarlson closed 6 years ago

nncarlson commented 6 years ago

The file proc_ptr_common.f90 actually has two errors. The first is the declaration of /com/ before its variables have been declared. This should be corrected to

11:  procedure(real), pointer :: p1,p2
12:  integer :: a,b
13:  common /com/ p1,p2,a,b

The primary error is the inclusion of procedure pointers in the common block. This is explicitly prohibited by C5100 (F08) and C5110 (F15). This is apparently a change from F03 where is was allowed (R558)

$ nagfor -kind=byte -f2003 proc_ptr_common_1.f90
NAG Fortran Compiler Release 6.1(Tozai) Build 6144
Error: proc_ptr_common_1.f90, line 13: Procedure P1 cannot occur in COMMON
       detected at P1@,
Error: proc_ptr_common_1.f90, line 13: Procedure P2 cannot occur in COMMON
       detected at P2@,
Error: proc_ptr_common_1.f90, line 24: Procedure FUNC1 cannot occur in COMMON
       detected at FUNC1@,
Error: proc_ptr_common_1.f90, line 24: Procedure FUNC2 cannot occur in COMMON
       detected at FUNC2@,
janusw commented 6 years ago

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84313

janusw commented 6 years ago

Fixed with d1c880e251b9a65509f347e02aa2ddd4b1cb6ee2. Closing.