This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33254] Diagnose different string lengths in array constructors at run time
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Oct 2007 12:59:50 -0000
- Subject: [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
- References: <bug-33254-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from tobi at gcc dot gnu dot org 2007-10-10 12:59 -------
I have a patch for this. Unfortunately, while playing around with testcases I
found a new segfault, so I'll have to look into this before submitting.
Failing testcase:
! { dg-do run }
! { dg-options "-fbounds-check" }
! { dg-shouldfail "Different CHARACTER lengths" }
! PR fortran/33254: No bounds checking for array constructors
program array_char
implicit none
character (len=2) :: x, y
character (len=2) :: z(2)
x = "a "
y = "cd"
z = [y(1:len(trim(y))), x(1:1)] ! causes segfault
z = [trim(x),trim(y)] ! [ "a", "cd" ] ->INVALID: different string lengths
end program array_char
! { dg-output "Different CHARACTER lengths .2/1. in array constructor" }
! { dg-output "Different CHARACTER lengths .1/2. in array constructor" }
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |tobi at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-08-31 08:16:55 |2007-10-10 12:59:49
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254