This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/82743] New: uncaught character truncation in derived type initialization
- From: "simon.kluepfel at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 27 Oct 2017 08:55:33 +0000
- Subject: [Bug fortran/82743] New: uncaught character truncation in derived type initialization
- Auto-submitted: auto-generated
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]