This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34828] ICE: GNU MP: Cannot reallocate memory for gfortran.dg/parameter_array_init_3.f90
- From: "jvdelisle at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2008 08:02:53 -0000
- Subject: [Bug fortran/34828] ICE: GNU MP: Cannot reallocate memory for gfortran.dg/parameter_array_init_3.f90
- References: <bug-34828-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from jvdelisle at gcc dot gnu dot org 2008-01-28 08:02 -------
Found the problem. We are trying to treat an EXPR_FUNCTION as if its an
EXPR_CONSTANT. I doubt the compilation is correct for any platform. Segfault
occurs here at 1053. I tried using gfc_simplify_expr with no luck.
1053 mpz_add (tmp, tmp, ar->as->upper[i]->value.integer);
(gdb) p *ar->as->upper[i]
$1 = {expr_type = EXPR_FUNCTION, ts = {type = BT_UNKNOWN, kind = 0,
derived = 0x0, cl = 0x0, is_c_interop = 0, is_iso_c = 0,
f90_type = BT_UNKNOWN}, rank = 0, shape = 0x0, symtree = 0x10aa91d0,
ref = 0x0, where = {nextc = 0x10ad61af "len(HEX1)) = [(1,i=1,len(HEX1))]",
lb = 0x10ad6170}, inline_noncopying_intrinsic = 0, is_boz = 0,
con_by_offset = 0x0, representation = {length = 0, string = 0x0}, value = {
logical = 0, integer = {{_mp_alloc = 0, _mp_size = 279614288,
_mp_d = 0x0}}, real = {{_mpfr_prec = 279614288, _mpfr_sign = 0,
_mpfr_exp = 0, _mpfr_d = 0x0}}, complex = {r = {{
_mpfr_prec = 279614288, _mpfr_sign = 0, _mpfr_exp = 0,
_mpfr_d = 0x0}}, i = {{_mpfr_prec = 0, _mpfr_sign = 0,
_mpfr_exp = 0, _mpfr_d = 0x0}}}, op = {
operator = GFC_INTRINSIC_BEGIN, uop = 0x0, op1 = 0x0, op2 = 0x0},
function = {actual = 0x10aa9350, name = 0x0, isym = 0x0, esym = 0x0},
character = {length = 0, string = 0x0}, constructor = 0x10aa9350}}
(gdb)
I am testing this patch:
@@ -1041,6 +1042,12 @@ find_array_element (gfc_constructor *con
goto depart;
}
+ /* Make sure we are dealing with constants. */
+ if (ar->as->upper[i]->expr_type != EXPR_CONSTANT
+ ||
+ ar->as->upper[i]->expr_type != EXPR_CONSTANT)
+ goto depart;
+
mpz_sub (delta, e->value.integer, ar->as->lower[i]->value.integer);
mpz_mul (delta, delta, span);
mpz_add (offset, offset, delta);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34828