This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Aug 2007 21:47:58 -0000
- Subject: [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following program is invalid Fortran 95/2003, but this cannot be diagnosed
at compile time:
program array_char
implicit none
character (len=2) :: x, y
x = "a "
y = "cd"
print*,[trim(x),trim(y)] ! [ "a", "cd" ] ->INVALID: different string lengths
end program array_char
While behavior of gfortran is ok (ifort, sunf95 and openf95 do the same), it
would be great if using, e.g., -fbounds-check an error would be printed:
NAG f95 prints for that program (at run time):
Unequal character lengths (2 and 1) in array constructor
and g95:
Fortran runtime error: Inconsistent string size in array constructor
--
Summary: Diagnose different string lengths in array constructors
at run time
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254