[Bug fortran/70409] New: Silent truncation of character parameters with len=huge()
anlauf at gmx dot de
gcc-bugzilla@gcc.gnu.org
Fri Mar 25 07:58:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70409
Bug ID: 70409
Summary: Silent truncation of character parameters with
len=huge()
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gmx dot de
Target Milestone: ---
Related to/derived from pr68441.
The following code demonstrates a strange behavior of character parameter
declarations if the len argument involves huge().
integer, parameter :: huge_1 = huge(0_1)
character( huge_1 ), parameter :: x = 'abc'
character( huge(0_1) ), parameter :: y = 'abc'
character( huge(0_1)+0 ), parameter :: z = 'abcdef'
character( huge(0_1) ) :: a = 'abc'
integer, parameter :: huge_2 = huge(0_2)
character( huge_2 ), parameter :: u = 'abc'
character( huge(0_2) ), parameter :: v = 'abc'
character(int(huge(0_2),4)), parameter :: w = 'abcdef'
character( huge(0_2) ) :: b = 'abc'
print*, huge_1, len(x), len(y), len(z), len (a)
print*, huge_2, len(u), len(v), len(w), len (b)
end
Output for 4.6 .. 6.0 trunk:
127 127 3 6 127
32767 32767 3 6 32767
Expected: all numbers should be 127 in the first line, 32767 in the second.
More information about the Gcc-bugs
mailing list