Bug 45608 - Bogus error about procedure attribute
Summary: Bogus error about procedure attribute
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-09-09 04:39 UTC by Jerry DeLisle
Modified: 2015-02-01 13:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-06-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerry DeLisle 2010-09-09 04:39:15 UTC
This test case is invalid.  It is rejected with an error message that is nonsense in this context.

program test

implicit none

type line_struct
  integer :: width = 10
end type

type symbol_struct
  integer :: typee = 10
end type

type curve_struct
  type (line_struct) line
  type (symbol_struct) symbol
end type

type (curve_struct) curve

namelist / params / curve

!

open (1, file = 'test.nml')
read (1, nml = params)
print *, curve(1)%symbol%typee

end program

$ gfc -g test.f90 
test.f90:20.17:

namelist / params / curve
                 1
Error: PROCEDURE attribute conflicts with NAMELIST attribute in 'curve' at (1)

Another example is:

program test2

implicit none

type line_struct
  integer :: width = 10
end type

type symbol_struct
  integer :: typee = 10
end type

type curve_struct
  type (line_struct) line
  type (symbol_struct) symbol
end type

type (curve_struct) curve

print *, curve(1)%symbol%typee

end program

$ gfc -g test2.f90 
/tmp/ccuBUha0.o: In function `test':
/home/jerry/prs/pr45532/pr45532.f90:20: undefined reference to `curve_'
collect2: ld returned 1 exit status
Comment 1 Tobias Burnus 2010-09-09 05:35:37 UTC
I am not sure how to improve this (internally).

NAG also prints:
f95 hjf.f90
Error: hjf.f90, line 26: Inconsistent usage of CURVE
       detected at )@%
Error: hjf.f90, line 26: Component of function reference
       detected at )@%

However, the error location could be better - instead of pointing to the NAMELIST line, one could - as NAG, ifort and g95 do - point to the PRINT line, e.g. g95:

print *, curve(1)%symbol%typee
              1
Error: PROCEDURE attribute conflicts with NAMELIST attribute in 'curve' at (1)
Comment 2 Dominique d'Humieres 2013-06-15 13:15:56 UTC
Still present at revision 200122. I share the Tobias' opinion that it won't be easy to get a better error message. This PR should probably be closed as WONTFIX.
Comment 3 Jerry DeLisle 2015-02-01 13:14:03 UTC
Agree.