GCC ICEs on folowing code with options -O2 -ftree-loop-distribution typedef long unsigned int size_t; typedef struct { long dat[2]; } gsl_complex_long_double; typedef struct { size_t size; size_t stride; long *data; } gsl_vector_complex_long_double; void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v) { long * const data = v->data; const size_t n = v->size; const size_t stride = v->stride; const gsl_complex_long_double zero = { { 0,0} } ; size_t i; for (i = 0; i < n; i++) *(gsl_complex_long_double *) (data + 2 * i * stride) = zero; } as prx.c: In function ‘gsl_vector_complex_long_double_set_zero’: prx.c:10: internal compiler error: in fold_binary, at fold-const.c:9308 Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/abuild/tbily/install/ --enable-checks --enable-bootstrap --disable-multilib Thread model: posix gcc version 4.4.0 20081118 (experimental) (GCC)
Created attachment 16758 [details] gcc ICEs on this file
In tree-loop-distribution.c (generate_memset_zero) can be DR_STEP(dr) NULL. But it is passed into fold_build2 that expect two non null expressions. If program flow goes to end: due to goto then temporary variables created during force_gimple_operand are added to referenced vars. But this variables have not def bb. So later checks fails.
Created attachment 16760 [details] This patch fixes problems
Subject: Re: ICE with -O2 -ftree-loop-distribution The patch looks good. Please test and ask for approval to commit to trunk on gcc-patches@. Thanks, Sebastian
Subject: Bug 38250 Author: tomby Date: Wed Dec 3 13:35:13 2008 New Revision: 142394 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142394 Log: PR middle-end/38250 * tree-loop-distribution.c (build_size_arg): New function. (generate_memset_zero): Checks if DR_STEP(de) is NULL. Reorganized generating of stmts. * testsuite/gcc.dg/tree-ssa/pr38250.c: New file. * tree-data-ref.c (dr_analyze_innermost): Returns bool. Indicate if analysis succeed. * tree-data-ref.h (dr_analyze_innermost): Returns bool. * tree-predcom.c (valid_initializer_p, find_looparound_phi): Uses new definition of dr_analyze_innermost. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-data-ref.c trunk/gcc/tree-data-ref.h trunk/gcc/tree-loop-distribution.c trunk/gcc/tree-predcom.c
Fixed.
*** Bug 36116 has been marked as a duplicate of this bug. ***