[Bug fortran/43996] ICE in simplification of spread intrinsic
dfranke at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed May 5 23:09:00 GMT 2010
------- Comment #8 from dfranke at gcc dot gnu dot org 2010-05-05 23:08 -------
It's late, but a conjecture ...
trans-array.c (gfc_conv_array_initializer):
/* Create an array constructor from an initialization expression.
We assume the frontend already did any expansions and conversions. */
Initialization expressions are required to be fully simplify-able at compile
time, otherwise an error is reported. Here, we have an allowed init expression
that has not been simplified but comes as a function call to be executed at
runtime. Hence, to fix this, one may need to handle EXPR_FUNCTION - or fully
expand the constructor.
Another candidate for this issue is MATMUL:
INTEGER :: i
INTEGER, PARAMETER :: N = 100, M = 1
INTEGER, PARAMETER :: A(N, M) = RESHAPE((/ (i, i = 1, N) /), (/ N, M /))
INTEGER, PARAMETER :: B(M, N) = RESHAPE((/ (i, i = 1, N) /), (/ M, N /))
INTEGER, PARAMETER :: C(N, N) = MATMUL(A, B)
PRINT *, SIZE(C), C(N/2, N/2)
END
For increasing N it (a) takes longer and longer - probably quadratic time - and
(b) eventually all memory will be used which leads to a crash. Adding a
max-constructor-size check to MATMUL will again bring us here. Test by
unconditionally returning NULL in MATMUL:
$ time gfortran-svn matmul.f03 && ./a.out
matmul.f03: In function 'MAIN__':
matmul.f03:1:0: internal compiler error: in gfc_conv_array_initializer, at
fortran/trans-array.c:4222
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Known to fail| |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43996
More information about the Gcc-bugs
mailing list