* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
@ 2014-03-07 14:13 ` janus at gcc dot gnu.org
2014-03-07 14:36 ` janus at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-07 14:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-07
CC| |janus at gcc dot gnu.org
Summary|ICE with SHAPE intrinsic |[4.7/4.8 Regression] ICE
| |with SHAPE intrinsic
Ever confirmed|0 |1
--- Comment #1 from janus at gcc dot gnu.org ---
The test case compiles cleanly here with 4.4 and 4.6, then I get segfaults with
4.7 and 4.8 and it works again with trunk.
With a current 4.8 branch build I get this backtrace:
f951: internal compiler error: Segmentation fault
0x8a96af crash_signal
/home/jweil/gcc48/branch/gcc/toplev.c:332
0x547d8b gfc_clear_shape(__mpz_struct (*) [1], int)
/home/jweil/gcc48/branch/gcc/fortran/expr.c:405
0x5b5d70 gfc_simplify_shape(gfc_expr*, gfc_expr*)
/home/jweil/gcc48/branch/gcc/fortran/simplify.c:5540
0x5567d1 do_simplify
/home/jweil/gcc48/branch/gcc/fortran/intrinsic.c:3810
0x563e66 gfc_intrinsic_func_interface(gfc_expr*, int)
/home/jweil/gcc48/branch/gcc/fortran/intrinsic.c:4160
0x59fe51 resolve_unknown_f
/home/jweil/gcc48/branch/gcc/fortran/resolve.c:2602
0x59fe51 resolve_function
/home/jweil/gcc48/branch/gcc/fortran/resolve.c:3204
0x59fe51 gfc_resolve_expr(gfc_expr*)
/home/jweil/gcc48/branch/gcc/fortran/resolve.c:6544
0x5a66e1 resolve_code
/home/jweil/gcc48/branch/gcc/fortran/resolve.c:10208
0x5a8b8e resolve_codes
/home/jweil/gcc48/branch/gcc/fortran/resolve.c:15061
0x599562 gfc_resolve
/home/jweil/gcc48/branch/gcc/fortran/resolve.c:15089
0x58dda2 resolve_all_program_units
/home/jweil/gcc48/branch/gcc/fortran/parse.c:4406
0x58dda2 gfc_parse_file()
/home/jweil/gcc48/branch/gcc/fortran/parse.c:4673
0x5c9de5 gfc_be_parse_file
/home/jweil/gcc48/branch/gcc/fortran/f95-lang.c:189
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
2014-03-07 14:13 ` [Bug fortran/60450] [4.7/4.8 Regression] " janus at gcc dot gnu.org
@ 2014-03-07 14:36 ` janus at gcc dot gnu.org
2014-03-07 14:42 ` janus at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-07 14:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #2 from janus at gcc dot gnu.org ---
Slightly reduced test case:
real, allocatable :: x(:,:)
allocate (x(3,2),source=99.)
print *, shape (x / 10.0)
end
Still works with 4.6 and trunk, but ICEs with 4.7 and 4.8.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
2014-03-07 14:13 ` [Bug fortran/60450] [4.7/4.8 Regression] " janus at gcc dot gnu.org
2014-03-07 14:36 ` janus at gcc dot gnu.org
@ 2014-03-07 14:42 ` janus at gcc dot gnu.org
2014-03-07 18:24 ` janus at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-07 14:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
--- Comment #3 from janus at gcc dot gnu.org ---
The following patch is sufficient to fix it on 4.8:
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (revision 208401)
+++ gcc/fortran/simplify.c (working copy)
@@ -5528,7 +5528,7 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *ki
if (e == &gfc_bad_expr || range_check (e, "SHAPE") == &gfc_bad_expr)
{
gfc_free_expr (result);
- if (t)
+ if (t == SUCCESS)
gfc_clear_shape (shape, source->rank);
return &gfc_bad_expr;
}
@@ -5536,7 +5536,7 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *ki
gfc_constructor_append_expr (&result->value.constructor, e, NULL);
}
- if (t)
+ if (t == SUCCESS)
gfc_clear_shape (shape, source->rank);
return result;
On trunk, 't' was changed from 'gfc_try' to bool in r197682, which also fixed
the problem.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (2 preceding siblings ...)
2014-03-07 14:42 ` janus at gcc dot gnu.org
@ 2014-03-07 18:24 ` janus at gcc dot gnu.org
2014-03-07 22:25 ` dave.allured at noaa dot gov
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-07 18:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> The following patch is sufficient to fix it on 4.8:
... and regtests cleanly.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (3 preceding siblings ...)
2014-03-07 18:24 ` janus at gcc dot gnu.org
@ 2014-03-07 22:25 ` dave.allured at noaa dot gov
2014-03-08 13:59 ` janus at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: dave.allured at noaa dot gov @ 2014-03-07 22:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #5 from Dave Allured <dave.allured at noaa dot gov> ---
Janus, thank you!
--Dave
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (4 preceding siblings ...)
2014-03-07 22:25 ` dave.allured at noaa dot gov
@ 2014-03-08 13:59 ` janus at gcc dot gnu.org
2014-03-08 14:05 ` janus at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-08 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #7 from janus at gcc dot gnu.org ---
Author: janus
Date: Sat Mar 8 13:59:00 2014
New Revision: 208430
URL: http://gcc.gnu.org/viewcvs?rev=208430&root=gcc&view=rev
Log:
2014-03-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/60450
* simplify.c (gfc_simplify_shape): Only clear shape if it was really
created successfully.
2014-03-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/60450
* gfortran.dg/shape_8.f90: New.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/shape_8.f90
Modified:
branches/gcc-4_8-branch/gcc/fortran/ChangeLog
branches/gcc-4_8-branch/gcc/fortran/simplify.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (5 preceding siblings ...)
2014-03-08 13:59 ` janus at gcc dot gnu.org
@ 2014-03-08 14:05 ` janus at gcc dot gnu.org
2014-03-09 18:25 ` dave.allured at noaa dot gov
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-08 14:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #8 from janus at gcc dot gnu.org ---
(In reply to kargl from comment #6)
> Patch is OK with a testcase.
Thanks, committed to the 4.8 branch as r208430. Will backport to 4.7 soon.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (6 preceding siblings ...)
2014-03-08 14:05 ` janus at gcc dot gnu.org
@ 2014-03-09 18:25 ` dave.allured at noaa dot gov
2014-03-09 18:45 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: dave.allured at noaa dot gov @ 2014-03-09 18:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #9 from Dave Allured <dave.allured at noaa dot gov> ---
(In reply to janus from comment #8)
>
> Thanks, committed to the 4.8 branch as r208430. Will backport to 4.7 soon.
Janus, are you sure that the release branch of 4.7 really needs a fix? My test
shows that the latest release, 4.7.3, passes this test case, but you said "4.7"
failed for you.
I just reconfirmed this with the Mac Ports distribution version of 4.7.3
(x86-64 target, Mac OS). I recall that my IT staff got the same positive
result for 4.7.3 on Linux, but I can't confirm that on the weekend.
mac56:~/gfortran/bugs/shape-bug 14> gfortran-mp-4.7 --version | grep gcc
GNU Fortran (MacPorts gcc47 4.7.3_3) 4.7.3
mac56:~/gfortran/bugs/shape-bug 15> gfortran-mp-4.7 -Wall -Wextra
shape-reduced.f90
mac56:~/gfortran/bugs/shape-bug 16> cat shape-reduced.f90
real, allocatable :: x(:,:)
allocate (x(3,2),source=99.)
print *, shape (x / 10.0)
end
mac56:~/gfortran/bugs/shape-bug 17> ./a.out
3 2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (7 preceding siblings ...)
2014-03-09 18:25 ` dave.allured at noaa dot gov
@ 2014-03-09 18:45 ` janus at gcc dot gnu.org
2014-03-09 19:01 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-09 18:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #10 from janus at gcc dot gnu.org ---
Author: janus
Date: Sun Mar 9 18:44:42 2014
New Revision: 208443
URL: http://gcc.gnu.org/viewcvs?rev=208443&root=gcc&view=rev
Log:
2014-03-09 Janus Weil <janus@gcc.gnu.org>
Backport from 4.8
2014-03-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/60450
* simplify.c (gfc_simplify_shape): Only clear shape if it was really
created successfully.
2014-03-09 Janus Weil <janus@gcc.gnu.org>
Backport from 4.8
2014-03-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/60450
* gfortran.dg/shape_8.f90: New.
Added:
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/shape_8.f90
Modified:
branches/gcc-4_7-branch/gcc/fortran/ChangeLog
branches/gcc-4_7-branch/gcc/fortran/simplify.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (8 preceding siblings ...)
2014-03-09 18:45 ` janus at gcc dot gnu.org
@ 2014-03-09 19:01 ` janus at gcc dot gnu.org
2014-03-09 19:06 ` janus at gcc dot gnu.org
2014-03-09 19:40 ` dave.allured at noaa dot gov
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-09 19:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #11 from janus at gcc dot gnu.org ---
(In reply to Dave Allured from comment #9)
> Janus, are you sure that the release branch of 4.7 really needs a fix? My
> test shows that the latest release, 4.7.3, passes this test case, but you
> said "4.7" failed for you.
Actually I tested the current state of the 4.7 branch, i.e. post-4.7.3, and
yes, in fact this fails.
It seems that the problem was only introduced after the 4.7.3 release, namely
in r198690.
I have just committed the fix to the 4.7 branch as r208443.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (9 preceding siblings ...)
2014-03-09 19:01 ` janus at gcc dot gnu.org
@ 2014-03-09 19:06 ` janus at gcc dot gnu.org
2014-03-09 19:40 ` dave.allured at noaa dot gov
11 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-09 19:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #12 from janus at gcc dot gnu.org ---
The bug has been fixed for the upcoming releases 4.8.3 and 4.7.4. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/60450] [4.7/4.8 Regression] ICE with SHAPE intrinsic
2014-03-06 21:24 [Bug fortran/60450] New: ICE with SHAPE intrinsic dave.allured at noaa dot gov
` (10 preceding siblings ...)
2014-03-09 19:06 ` janus at gcc dot gnu.org
@ 2014-03-09 19:40 ` dave.allured at noaa dot gov
11 siblings, 0 replies; 13+ messages in thread
From: dave.allured at noaa dot gov @ 2014-03-09 19:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450
--- Comment #13 from Dave Allured <dave.allured at noaa dot gov> ---
(In reply to janus from comment #11)
> (In reply to Dave Allured from comment #9)
> > Janus, are you sure that the release branch of 4.7 really needs a fix? My
> > test shows that the latest release, 4.7.3, passes this test case, but you
> > said "4.7" failed for you.
>
> Actually I tested the current state of the 4.7 branch, i.e. post-4.7.3, and
> yes, in fact this fails.
>
> It seems that the problem was only introduced after the 4.7.3 release,
> namely in r198690.
>
> I have just committed the fix to the 4.7 branch as r208443.
Okay, that's great to have the discrepancy explained. Thanks again Janus.
^ permalink raw reply [flat|nested] 13+ messages in thread