public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98558] New: Scalar character parameter does not print warning if actual length >1
@ 2021-01-06  9:31 federico.perini at gmail dot com
  2021-01-06 17:46 ` [Bug fortran/98558] " kargl at gcc dot gnu.org
  2021-01-07  8:32 ` federico.perini at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: federico.perini at gmail dot com @ 2021-01-06  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/98558] Scalar character parameter does not print warning if actual length >1
  2021-01-06  9:31 [Bug fortran/98558] New: Scalar character parameter does not print warning if actual length >1 federico.perini at gmail dot com
@ 2021-01-06 17:46 ` kargl at gcc dot gnu.org
  2021-01-07  8:32 ` federico.perini at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-01-06 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2021-01-06
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
What options are you using?

% gfcg -c -Wall b.f90
b.f90:4:40:

    4 |       character, parameter :: b = 'bbbbb'  ! NO -> No warnings printed!
      |                                        1
Warning: CHARACTER expression at (1) is being truncated (5/1)
[-Wcharacter-truncation]
b.f90:5:40:

    5 |       character(len=1), parameter :: c = 'ccccc'  ! NO -> No warnings
printed!
      |                                        1
Warning: CHARACTER expression at (1) is being truncated (5/1)
[-Wcharacter-truncation]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/98558] Scalar character parameter does not print warning if actual length >1
  2021-01-06  9:31 [Bug fortran/98558] New: Scalar character parameter does not print warning if actual length >1 federico.perini at gmail dot com
  2021-01-06 17:46 ` [Bug fortran/98558] " kargl at gcc dot gnu.org
@ 2021-01-07  8:32 ` federico.perini at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: federico.perini at gmail dot com @ 2021-01-07  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

federico <federico.perini at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|WAITING                     |RESOLVED

--- Comment #2 from federico <federico.perini at gmail dot com> ---
My bad, 

I haven't tested this with the warning flags on.

Thanks!
Federico

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-07  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06  9:31 [Bug fortran/98558] New: Scalar character parameter does not print warning if actual length >1 federico.perini at gmail dot com
2021-01-06 17:46 ` [Bug fortran/98558] " kargl at gcc dot gnu.org
2021-01-07  8:32 ` federico.perini at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).