------- Comment #20 from jakub at gcc dot gnu dot org 2007-10-31 16:31 -------
What I'd try instead is something like:
--- tree-data-ref.c.jj11 2007-10-28 19:34:10.000000000 +0100
+++ tree-data-ref.c 2007-10-31 16:22:21.000000000 +0100
@@ -629,7 +629,7 @@ dr_analyze_innermost (struct data_refere
enum machine_mode pmode;
int punsignedp, pvolatilep;
affine_iv base_iv, offset_iv;
- tree init, dinit, step;
+ tree init, dinit, step, type;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "analyze_innermost: ");
@@ -666,9 +666,21 @@ dr_analyze_innermost (struct data_refere
init = ssize_int (pbitpos / BITS_PER_UNIT);
split_constant_offset (base_iv.base, &base_iv.base, &dinit);
- init = size_binop (PLUS_EXPR, init, dinit);
+ init = size_binop (PLUS_EXPR, init, dinit);
split_constant_offset (offset_iv.base, &offset_iv.base, &dinit);
- init = size_binop (PLUS_EXPR, init, dinit);
+ init = size_binop (PLUS_EXPR, init, dinit);
+
+ /* See if base address involves a variable length type somewhere.
+ Bases with such types shouldn't be gimplified again. */
+ type = TREE_TYPE (base_iv.base);
+ while (POINTER_TYPE_P (type))
+ type = TREE_TYPE (type);
+ if (int_size_in_bytes (type) < 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "failed: base involves a variable length
type.\n");
+ return;
+ }
step = size_binop (PLUS_EXPR,
fold_convert (ssizetype, base_iv.step),
or similar check in the vectorizer instead. This exact patch breaks
gfortran.dg/vect/vect-3.f90 and gfortran.dg/vect/pr19049.f90 (they are no
longer vectorized as expected), would need to see whether it tries to unsafely
gimplify the VLA type sizes in the vectorizer or not.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33680