https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87644
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-10-19
CC| |burnus at gcc dot gnu.org
Summary|ICE due to variable named |[7/8/9 Regression] ICE due
|"parameters" |to variable named
| |"parameters"
Ever confirmed|0 |1
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Irks!
(A) gfortran supports as legacy extension parameter declarations without "()"
=> The issue of comment 0 is due to the legacy support
=> It was added for GCC 7 on 2016-11-03 in commit r241823
=> Needs to be fixed for valid standard Fortran code
(Actually, I wonder why we enter the do_param handling, given that there is no
space after 'parameter' before the 's='; with free-form Fortran I had expected
that there must be a white space [or '('] in order to be a parameter
statement.)
=> For legacy code, there seems to be in addition an ambiguity
if one ignores the '()'. Namely:
Assume fixed-format which ignores spaces and, for simplicity, assume implicit
typing and any of those (all are the same with fixed-form Fortran):
parameterABC=7
parameter ABC = 7
p aram et erAB C =7
Shall this be regarded as
implicit none
real :: parameterABC
parameterABC = 7.0
or as
implicit none
real :: ABC
parameter (ABC = 7.0)
This ambiguity only applies to --std=legacy but still one it has to be
resolved!
(B) We should check whether there are any parsing issues with "parameter..."
variables for standard conforming code. At a glance, it seems to work - but we
might miss some corner cases.
In any case, parameter without '(' is not a valid PARAMETER statement according
to the standard. With '(' we can have assignments and pointer assignments to
array variables such as:
parameter(idx) = ...
parameterABC(:) = ...
parameter(5:) => pointer_target
parameterABC(5:) => pointer_target
parameter(f(arg=5):) => pointer_target
Some testing indicates that gfortran handle those correctly.