https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92091
Bug ID: 92091
Summary: Inconsistent diagnostics for INCLUDE vs. #include
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
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.