This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/82743] New: uncaught character truncation in derived type initialization


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

            Bug ID: 82743
           Summary: uncaught character truncation in derived type
                    initialization
           Product: gcc
           Version: 7.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon.kluepfel at gmail dot com
  Target Milestone: ---

Initializing a derived type with a character component with a string too long
is not caught by -Wcharacter-truncation.

PROGRAM TEST
    TYPE A
        CHARACTER(LEN=1) :: C
    END TYPE A
    TYPE(A) :: A1
    A1=A("123")
    A1=A(C="123")
    A1%C="123"
END PROGRAM TEST

compiling with gfortran 7.1.1 and -Wall -Wextra gives only one warning:

main.f95:8:14:

     A1%C="123"
              1
Warning: CHARACTER expression will be truncated in assignment (1/3) at (1)
[-Wcharacter-truncation]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]