[Bug fortran/33727] Segfault with ugly string array constructor
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #6 from tobi at gcc dot gnu dot org 2007-10-13 21:44 --- Subject: Bug 33727 Author: tobi Date: Sat Oct 13 21:43:49 2007 New Revision: 129286 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=129286 Log: 2007-10-13 Tobias Schlueter [EMAIL PROTECTED] Paul Thomas [EMAIL PROTECTED] PR fortran/33254 PR fortran/33727 fortran/ * trans-array.c (get_array_ctor_var_strlen): Check upper bound for constness instead of lower bound. (get_array_ctor_strlen): Add bounds-checking code. testsuite/ * bounds_check_10.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/bounds_check_10.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-array.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #7 from tobi at gcc dot gnu dot org 2007-10-13 21:45 --- Fixed. -- tobi at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #8 from tobi at gcc dot gnu dot org 2007-10-13 22:28 --- Dominique, I forgot to say: your testcase is also fixed by Paul's patch, and it's really the same problem, so the testcase I added is enough. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #5 from pault at gcc dot gnu dot org 2007-10-11 07:26 --- Confirmed. Tobias, You should have received the fix. Cheers Paul Index: gcc/fortran/trans-array.c === *** gcc/fortran/trans-array.c (révision 129121) --- gcc/fortran/trans-array.c (copie de travail) *** get_array_ctor_var_strlen (gfc_expr * ex *** 1340,1346 case REF_SUBSTRING: if (ref-u.ss.start-expr_type != EXPR_CONSTANT ! || ref-u.ss.start-expr_type != EXPR_CONSTANT) break; mpz_init_set_ui (char_len, 1); mpz_add (char_len, char_len, ref-u.ss.end-value.integer); --- 1340,1346 case REF_SUBSTRING: if (ref-u.ss.start-expr_type != EXPR_CONSTANT ! || ref-u.ss.end-expr_type != EXPR_CONSTANT) break; mpz_init_set_ui (char_len, 1); mpz_add (char_len, char_len, ref-u.ss.end-value.integer); -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2007-10-11 07:26:59 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #3 from dominiq at lps dot ens dot fr 2007-10-10 14:38 --- Note that the (IMHO) valid code: program array_char implicit none character (len=2) :: x, y character (len=2) :: z(2) x = a y = cd z = (/y(1:len(trim(x))), x(1:len(trim(x)))/) ! causes segfault print *, z end program array_char gives also the same ICE: [address=43248000 pc=430c1a90] pr33727_db.f90: In function 'MAIN__': pr33727_db.f90:6: internal compiler error: Segmentation Fault -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #4 from tobi at gcc dot gnu dot org 2007-10-10 14:40 --- OTOH this works: program array_char implicit none character (len=2) :: x character (len=1) :: z x = a z = x(1:len(trim(x))) end program array_char So the problem is with array constructors. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #1 from tobi at gcc dot gnu dot org 2007-10-10 14:25 --- There's a disabled check in bounds_check_10.f90 (to be submitted) which depends on this bug, please enable it after fixing. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727
[Bug fortran/33727] Segfault with ugly string array constructor
--- Comment #2 from tobi at gcc dot gnu dot org 2007-10-10 14:34 --- (In reply to comment #1) There's a disabled check in bounds_check_10.f90 (to be submitted) which depends on this bug, please enable it after fixing. Scratch that, of course after the first runtime error the testcase will stop, so there's no point in checking multiple runtime errors :-) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33727