[Bug fortran/77391] gfortran allows CHARACTER(LEN=:),PARAMETER:: STRING='constant' buts does not report it as an extension

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 26 20:08:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77391

kargl at gcc dot gnu.org changed:

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

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #2)
> Sorry, but I think the constraint C402 does not apply to named constants
> (AKA PARAMETER).

It applies.  C402 is a number constraint.  A Fortran processor
must report violations of a constraint.

C402 (R401) A colon shall not be used as a type-param-value except
in the declaration of an entity or component that has the POINTER
or ALLOCATABLE attribute.

There is no "except for a named constant".


> Last point, I don't see how a PARAMETER can be ALLOCATABLE.

It takes all of 2 minutes to see that gfortran already reports
conflicts

troutmask:sgk[208] gfc7 -c a.f90
a.f90:3:34:

 character(len=:),parameter,pointer :: ident2="which appears to be an
extension?"
                                  1
Error: PARAMETER attribute conflicts with POINTER attribute at (1)
troutmask:sgk[209] gfc7 -c a.f90
a.f90:3:26:

 character(len=:),parameter,allocatable :: ident2="which appears to be an
extension?"
                          1
Error: PARAMETER attribute conflicts with ALLOCATABLE attribute at (1)


More information about the Gcc-bugs mailing list