For files included via INCLUDE, the diagnostics printed may be incomplete when the included file resides in a different directory. There is no problem when using #include. Reproducer: % cat bug.f90 module bug implicit none public include 'inc1.f90' include 'inc2.f90' end module bug # cat bug.F90 module bug implicit none public #include "inc1.f90" #include "inc2.f90" end module bug % cat otherdir/inc1.f90 character*1 c % cat inc2.f90 character*2 d Using e.g. svn rev.276967, I get: % gfc-10 -c bug.f90 -Iotherdir -std=f2008 inc1.f90:1:14: Warning: Obsolescent feature: Old-style character length at (1) inc2.f90:1:14: 1 | character*2 d | 1 Warning: Obsolescent feature: Old-style character length at (1) % gfc-10 -c bug.F90 -Iotherdir -std=f2008 otherdir/inc1.f90:1:14: 1 | character*1 c | 1 Warning: Obsolescent feature: Old-style character length at (1) inc2.f90:1:14: 1 | character*2 d | 1 Warning: Obsolescent feature: Old-style character length at (1) Note that the diagnostics for inc1.f90 is incomplete for INCLUDE. Also, the filename does not show the full path in that case. Not sure if this is relevant to the issue. This affects all gcc versions down to at least 7.x, so no regression.
(In reply to anlauf from comment #0) > For files included via INCLUDE, the diagnostics printed may be incomplete > when the included file resides in a different directory. There is no > problem when using #include. > > Reproducer: > > % cat bug.f90 > module bug > implicit none > public > include 'inc1.f90' > include 'inc2.f90' > end module bug > > # cat bug.F90 > module bug > implicit none > public > #include "inc1.f90" > #include "inc2.f90" > end module bug > > % cat otherdir/inc1.f90 > character*1 c > > % cat inc2.f90 > character*2 d > > > Using e.g. svn rev.276967, I get: > > % gfc-10 -c bug.f90 -Iotherdir -std=f2008 > inc1.f90:1:14: > > Warning: Obsolescent feature: Old-style character length at (1) > inc2.f90:1:14: > > 1 | character*2 d > | 1 > Warning: Obsolescent feature: Old-style character length at (1) > > % gfc-10 -c bug.F90 -Iotherdir -std=f2008 > otherdir/inc1.f90:1:14: > > 1 | character*1 c > | 1 > Warning: Obsolescent feature: Old-style character length at (1) > inc2.f90:1:14: > > 1 | character*2 d > | 1 > Warning: Obsolescent feature: Old-style character length at (1) > > > Note that the diagnostics for inc1.f90 is incomplete for INCLUDE. > Also, the filename does not show the full path in that case. Not > sure if this is relevant to the issue. > Technical the full path isn't shown for any of your examples.
See pr94931 for the include path. Am I correct to understand that #include is handled by the preprocessor?
(In reply to Dominique d'Humieres from comment #2) > Am I correct to understand that #include is handled by the preprocessor? Yes. Other compilers always show the path to the included file in the warning. E.g. Intel: % ifort pr92091.f90 -stand -Iotherdir -c otherdir/inc1.f90(1): warning #7346: The CHARACTER* form of a CHARACTER declaration is an obsolescent feature in Fortran 2003. character*1 c ------------^ inc2.f90(1): warning #7346: The CHARACTER* form of a CHARACTER declaration is an obsolescent feature in Fortran 2003. character*2 d ------------^ Similarly for pr92091.F90 .