[Bug fortran/98558] New: Scalar character parameter does not print warning if actual length >1

federico.perini at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 6 09:31:20 GMT 2021


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

            Bug ID: 98558
           Summary: Scalar character parameter does not print warning if
                    actual length >1
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: federico.perini at gmail dot com
  Target Milestone: ---

Created attachment 49898
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49898&action=edit
test program

More of a suggestion than a bug (I don't see memory issues).

If I initialize a CHARACTER, PARAMETER variable with a string whose lenght is
>1, no warnings are printed in gcc/gfortran 9.2.0: 

program test_char_parameter
      implicit none
      character       , parameter :: a = 'a'      ! OK
      character       , parameter :: b = 'bbbbb'  ! NO -> No warnings printed!
      character(len=1), parameter :: c = 'ccccc'  ! NO -> No warnings printed!
      character(len=*), parameter :: d = 'ddddd'  ! OK

      print *, a
      print *, b
      print *, c
      print *, d

end program test_char_parameter

Best,
Federico


More information about the Gcc-bugs mailing list