https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88299
Bug ID: 88299
Summary: [9 Regression] COMMON in a legacy module produces
bogus warnings in dependent code
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gmx dot de
Target Milestone: ---
The following code shows an issue with COMMON in a legacy module that
is used by "modern" code (-std=f2018):
% cat gfcbug150.f90
module legacy
integer :: major, minor
common /version/ major, minor
public :: major, minor
private
end module legacy
module mod1
use legacy, only: major
integer :: n
public :: n
private
end module mod1
module mod2
use mod1, only: n
end module mod2
I get with current 9-trunk:
% gfc-trunk -c -std=f2018 gfcbug150.f90
gfcbug150.f90:3:18:
3 | common /version/ major, minor
| 1
Warning: Fortran 2018 obsolescent feature: COMMON block at (1)
gfcbug150.f90:9:6:
9 | use legacy, only: major
| 1
Warning: Fortran 2018 obsolescent feature: COMMON block at (1)
gfcbug150.f90:16:6:
16 | use mod1, only: n
| 1
Warning: Fortran 2018 obsolescent feature: COMMON block at (1)
One might compile the first module separately with another -std version,
but this does not remove the warnings in the separately compiled dependent
modules.