[Bug fortran/43996] New: ICE in simplification of spread intrinsic
dominiq at lps dot ens dot fr
gcc-bugzilla@gcc.gnu.org
Wed May 5 21:04:00 GMT 2010
The following test extracted from
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40472#c21 gives an ICE with vanilla
trunk at revision 159082:
REAL, DIMENSION(720,360), PARAMETER :: ZLON_MASK = SPREAD( (/ (JLON ,
JLON=1,720) /) , DIM=2, NCOPIES=360 )
print *, size(ZLON_MASK), ZLON_MASK(720,360)
end
[macbook] f90/bug% gfcp pr40472_1.f90
pr40472_1.f90: In function 'MAIN__':
pr40472_1.f90:2:0: internal compiler error: in gfc_conv_array_initializer, at
fortran/trans-array.c:4222
The backtrace is
Breakpoint 1, fancy_abort (file=0x100992a40
"../../p_work/gcc/fortran/trans-array.c", line=4222, function=0x1009fc620
"gfc_conv_array_initializer") at ../../p_work/gcc/diagnostic.c:810
810 {
(gdb) bt
#0 fancy_abort (file=0x100992a40 "../../p_work/gcc/fortran/trans-array.c",
line=4222, function=0x1009fc620 "gfc_conv_array_initializer") at
../../p_work/gcc/diagnostic.c:810
#1 0x00000001000b1f21 in gfc_conv_array_initializer (type=0x141e13738,
expr=0x141814bc0) at ../../p_work/gcc/fortran/trans-array.c:4222
#2 0x00000001000d3ecb in gfc_conv_initializer (expr=0x141814bc0, ts=<value
temporarily unavailable, due to optimizations>, type=0x141e13738, array=<value
temporarily unavailable, due to optimizations>, pointer=<value temporarily
unavailable, due to optimizations>) at
../../p_work/gcc/fortran/trans-expr.c:3886
#3 0x00000001000c20f2 in gfc_get_symbol_decl (sym=0x141814880) at
../../p_work/gcc/fortran/trans-decl.c:1295
#4 0x00000001000d179b in gfc_conv_variable (se=0x7fff5fbfd480,
expr=0x14181eb40) at ../../p_work/gcc/fortran/trans-expr.c:569
#5 0x00000001000d0e3d in gfc_conv_expr_reference (se=0x7fff5fbfd480,
expr=<value temporarily unavailable, due to optimizations>) at
../../p_work/gcc/fortran/trans-expr.c:4554
#6 0x00000001000e6114 in gfc_trans_transfer (code=0x14181ef30) at
../../p_work/gcc/fortran/trans-io.c:2246
#7 0x00000001000aac88 in trans_code (code=0x14181ef30, cond=0x1417f5118) at
../../p_work/gcc/fortran/trans.c:1261
#8 0x00000001000e3d69 in build_dt (function=0x141e11200, code=0x14181f320) at
../../p_work/gcc/fortran/trans-io.c:1817
#9 0x00000001000aaca8 in trans_code (code=0x14181f320, cond=0x0) at
../../p_work/gcc/fortran/trans.c:1233
#10 0x00000001000c7a4f in gfc_generate_function_code (ns=<value temporarily
unavailable, due to optimizations>) at
../../p_work/gcc/fortran/trans-decl.c:4422
#11 0x000000010006ba4f in gfc_parse_file () at
../../p_work/gcc/fortran/parse.c:4317
#12 0x00000001000a611c in gfc_be_parse_file (set_yydebug=<value temporarily
unavailable, due to optimizations>) at ../../p_work/gcc/fortran/f95-lang.c:239
#13 0x00000001006d959c in toplev_main (argc=2, argv=0x7fff5fbfd9f0) at
../../p_work/gcc/toplev.c:1053
#14 0x00000001000015c4 in start ()
If the following patch is applied:
diff -up ../_clean/gcc/fortran/simplify.c gcc/fortran/simplify.c
--- ../_clean/gcc/fortran/simplify.c 2010-04-28 22:47:13.000000000 +0200
+++ gcc/fortran/simplify.c 2010-05-05 20:01:15.000000000 +0200
@@ -4926,7 +4926,6 @@ gfc_simplify_spread (gfc_expr *source, g
{
gfc_expr *result = 0L;
int i, j, dim, ncopies;
- mpz_t size;
if ((!gfc_is_constant_expr (source)
&& !is_constant_array_expr (source))
@@ -4942,19 +4941,6 @@ gfc_simplify_spread (gfc_expr *source, g
gfc_extract_int (ncopies_expr, &ncopies);
ncopies = MAX (ncopies, 0);
- /* Do not allow the array size to exceed the limit for an array
- constructor. */
- if (source->expr_type == EXPR_ARRAY)
- {
- if (gfc_array_size (source, &size) == FAILURE)
- gfc_internal_error ("Failure getting length of a constant array.");
- }
- else
- mpz_init_set_ui (size, 1);
-
- if (mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor)
- return NULL;
-
if (source->expr_type == EXPR_CONSTANT)
{
gcc_assert (dim == 0);
The ICE goes away:
[macbook] f90/bug% gfc pr40472_1.f90
[macbook] f90/bug% a.out
259200 720.00000
--
Summary: ICE in simplification of spread intrinsic
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dominiq at lps dot ens dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43996
More information about the Gcc-bugs
mailing list