This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 22 Sep 2012 21:57:52 +0000
- Subject: [Bug fortran/45440] [F03] ALLOCATE with SOURCE gives an ICE (segfault)
- Auto-submitted: auto-generated
- References: <bug-45440-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45440
--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-09-22 21:57:52 UTC ---
If I apply the following patch
--- ../_clean/gcc/fortran/resolve.c 2012-09-17 15:50:08.000000000 +0200
+++ gcc/fortran/resolve.c 2012-09-22 18:02:47.000000000 +0200
@@ -7051,10 +7053,15 @@ conformable_arrays (gfc_expr *e1, gfc_ex
mpz_sub (s, s, tail->u.ar.start[i]->value.integer);
mpz_add_ui (s, s, 1);
}
- else
+ else if(tail->u.ar.start[i])
{
mpz_set (s, tail->u.ar.start[i]->value.integer);
}
+ else
+ {
+ gcc_unreachable ();
+ /* mpz_set (s, e1->shape[i]); */
+ }
if (mpz_cmp (e1->shape[i], s) != 0)
{
the segmentation fault is indeed replaced with
f951: internal compiler error: in conformable_arrays, at fortran/resolve.c:7062
which means that the allocatable corresponding to tail should be "decorated"
(bounds, size, ...) somewhere (in a way similar to the lhs reallocation on
assignment).
Also the new else if block seems weird in two counts:
(1) I do not see how it can be reached (I tried something such as b(3:), but I
got a syntax error earlier).
(2) I does not make sense for me to compare tail->u.ar.start[i] to
e1->shape[i].