[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #10 from janus at gcc dot gnu.org 2013-01-24 23:58:18 UTC --- Author: janus Date: Thu Jan 24 23:58:12 2013 New Revision: 195447 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195447 Log: 2013-01-24 Janus Weil ja...@gcc.gnu.org PR fortran/56081 * resolve.c (resolve_select): Add argument 'select_type', reject non-scalar expressions. (resolve_select_type,resolve_code): Pass new argument to 'resolve_select'. 2013-01-24 Janus Weil ja...@gcc.gnu.org PR fortran/56081 * gfortran.dg/select_8.f90: New. Added: branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/select_8.f90 Modified: branches/gcc-4_7-branch/gcc/fortran/ChangeLog branches/gcc-4_7-branch/gcc/fortran/resolve.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 janus at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED --- Comment #11 from janus at gcc dot gnu.org 2013-01-24 23:59:27 UTC --- Fixed on trunk and 4.7. Closing. Thanks for the report!
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 janus at gcc dot gnu.org changed: What|Removed |Added Keywords||ice-on-invalid-code Status|UNCONFIRMED |NEW Last reconfirmed||2013-01-23 CC||janus at gcc dot gnu.org Known to work||4.6.4 Summary|Seg fault ICE on select |[4.7/4.8 Regression] Seg |with bad case |fault ICE on select with ||bad case Ever Confirmed|0 |1 --- Comment #3 from janus at gcc dot gnu.org 2013-01-23 08:30:34 UTC --- Further reduction: implicit none integer :: a(4) select case(a) case (0) end select end gfortran 4.6.4 gives the correct error message: select case(a) 1 Error: Argument of SELECT statement at (1) must be a scalar expression For some reason this is not being triggered any more with 4.7 and trunk.
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #4 from janus at gcc dot gnu.org 2013-01-23 09:09:56 UTC --- On the 4.6 branch, one finds the following check in resolve.c (resolve_select, line 7426): if (case_expr-rank != 0) { gfc_error (Argument of SELECT statement at %L must be a scalar expression, case_expr-where); /* Punt. */ return; } On the 4.7 branch it is simply gone. I don't directly see where it went.
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #5 from janus at gcc dot gnu.org 2013-01-23 09:13:19 UTC --- In ChangeLog-2011 I see the following commit: 2011-12-11 Paul Thomas pa...@gcc.gnu.org Tobias Burnus bur...@gcc.gnu.org PR fortran/41539 PR fortran/43214 PR fortran/43969 PR fortran/44568 PR fortran/46356 PR fortran/46990 PR fortran/49074 [...] (resolve_select): Remove scalar error for SELECT statement as a temporary measure. [...]
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #6 from janus at gcc dot gnu.org 2013-01-23 09:21:02 UTC --- The obvious fix is certainly to re-insert that piece of code: Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c(revision 195310) +++ gcc/fortran/resolve.c(working copy) @@ -7976,6 +7976,15 @@ resolve_select (gfc_code *code) return; } + if (case_expr-rank != 0) +{ + gfc_error (Argument of SELECT statement at %L must be a scalar + expression, case_expr-where); + + /* Punt. */ + return; +} + /* Raise a warning if an INTEGER case value exceeds the range of the case-expr. Later, all expressions will be promoted to the largest kind of all case-labels. */ Will check for regressions now.
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #7 from janus at gcc dot gnu.org 2013-01-23 09:52:30 UTC --- (In reply to comment #6) Will check for regressions now. Unfortunately it seems to trigger a large number of regressions in the testsuite, e.g. on: FAIL: gfortran.dg/class_allocate_10.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_allocate_8.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_1.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_2.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_7.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_to_type_1.f03 -O0 (test for excess errors)
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #8 from janus at gcc dot gnu.org 2013-01-23 10:00:31 UTC --- (In reply to comment #7) FAIL: gfortran.dg/class_allocate_10.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_allocate_8.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_1.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_2.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_array_7.f03 -O0 (test for excess errors) FAIL: gfortran.dg/class_to_type_1.f03 -O0 (test for excess errors) In fact all of these seem to be due to SELECT TYPE statements with class arrays (which are being transformed into an ordinary SELECT at resolution time), so one should probably add an extra check, whether it actually comes from a SELECT TYPE statement.
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 janus at gcc dot gnu.org changed: What|Removed |Added Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org |
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P5 Target Milestone|--- |4.7.3
[Bug fortran/56081] [4.7/4.8 Regression] Seg fault ICE on select with bad case
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56081 --- Comment #9 from janus at gcc dot gnu.org 2013-01-23 21:38:44 UTC --- Author: janus Date: Wed Jan 23 21:38:40 2013 New Revision: 195412 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195412 Log: 2013-01-23 Janus Weil ja...@gcc.gnu.org PR fortran/56081 * resolve.c (resolve_select): Add argument 'select_type', reject non-scalar expressions. (resolve_select_type,resolve_code): Pass new argument to 'resolve_select'. 2013-01-23 Janus Weil ja...@gcc.gnu.org PR fortran/56081 * gfortran.dg/select_8.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/select_8.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog