http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53086

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-25 
06:46:03 UTC ---
(In reply to comment #2)
> In most units we have
>       COMMON /FMCOM / X(1)
> but in unport.F
>       PARAMETER (MEMSIZ=   80 000 000)
>       COMMON /FMCOM / X(MEMSIZ)
> that can't work (?)

The Fortran standard requires that all named common blocks [with the same name]
have the same size (which is violated here). However, in practice, several
Fortran programs violate this rule.

For unnamed common blocks ("common // var1, var2"), different sizes are
allowed. However, accessing elements beyond the last argument - like "X(2)" for
the first definition - is invalid.

Thus, the -fcheck=bounds error seems to be appropriate. The question is what we
do about x(2). While it is invalid, it seems to be used. As the Fortran FE
knows that the last item in a given common block is an array element, it could
change the middle-end decl to "[1:]".

(I have not yet checked the exact wording in the Fortran 66 to 2008 standards.)

Reply via email to