------- Comment #2 from tkoenig at gcc dot gnu dot org  2009-06-22 19:28 -------
Confirmed.

Backtrace:

0  0xb7e574ab in __gmpz_get_si () from /usr/local/lib/libgmp.so.3
#1  0x08132738 in gfc_simplify_spread (source=0x8c370b8, dim_expr=0x8c37128,
    ncopies_expr=0x8c37198) at ../../../gcc/trunk/gcc/fortran/simplify.c:5121
#2  0xbfcf342c in ?? ()
#3  0xbfcf342c in ?? ()
#4  0xbfcf3400 in ?? ()
#5  0x080f62c1 in gfc_get_string (format=0xb7a2ee28 "spread")
    at ../../../gcc/trunk/gcc/fortran/iresolve.c:56
#6  0x080e1ed1 in find_sym (start=0x736e6972, n=-1076939732,
    name=0x80000000 <Address 0x80000000 out of bounds>)
    at ../../../gcc/trunk/gcc/fortran/intrinsic.c:844
#7  0x08bc931c in ?? ()
#8  0x08c37208 in ?? ()
#9  0x00000000 in ?? ()

The problem appears to be an unititialized (?) size when
ncopies is zero in gfc_simplify_spread:

(gdb) up
#1  0x08132738 in gfc_simplify_spread (source=0x8c370b8, dim_expr=0x8c37128,
    ncopies_expr=0x8c37198) at ../../../gcc/trunk/gcc/fortran/simplify.c:5121
5121      if (mpz_get_si (size)*ncopies >
gfc_option.flag_max_array_constructor)
(gdb) p size
$1 = {{_mp_alloc = 147026216, _mp_size = 1953392936, _mp_d = 0x736e6972}}
(gdb) p ncopies
$2 = 0

This patchlet avoids the ICE:

ndex: simplify.c
===================================================================
--- simplify.c  (revision 148807)
+++ simplify.c  (working copy)
@@ -5118,7 +5118,8 @@ gfc_simplify_spread (gfc_expr *source, g
   /* Do not allow the array size to exceed the limit for an array
      constructor.  */
   gfc_array_size (source, &size);
-  if (mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor)
+  if (ncopies && mpz_get_si (size)*ncopies
+      > gfc_option.flag_max_array_constructor)
     return NULL;

   if (source->expr_type == EXPR_CONSTANT)

I'm regression-testing it right now.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-22 19:28:26
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40520

Reply via email to