From 6481b879bad720854a3a1f8be3edc2940b3d4085 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 10 Nov 2007 08:40:37 +0100 Subject: [PATCH] re PR tree-optimization/33680 (ICE when compilling elbg.c from ffmpeg (vectorizer)) PR tree-optimization/33680 * tree-data-ref.c (split_constant_offset) : Punt if the added cast involves variable length types. * gcc.c-torture/compile/20071108-1.c: New test. From-SVN: r130067 --- gcc/ChangeLog | 64 ++++++++++--------- gcc/testsuite/ChangeLog | 3 + .../gcc.c-torture/compile/20071108-1.c | 13 ++++ gcc/tree-data-ref.c | 22 ++++++- 4 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20071108-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34b70aedebff..b5e532d93ad6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,13 +1,19 @@ +2007-11-10 Jakub Jelinek + + PR tree-optimization/33680 + * tree-data-ref.c (split_constant_offset) : Punt + if the added cast involves variable length types. + 2007-11-09 Alexander Monakov Maxim Kuvyrkov - * gcc/sched-deps.c (sched_analyze_insn): Use MOVE_BARRIER + * sched-deps.c (sched_analyze_insn): Use MOVE_BARRIER instead of TRUE_BARRIER for jumps. Add register dependencies even when reg_pending_barrier is set. 2007-11-09 Alexander Monakov - * gcc/haifa-sched.c (haifa_classify_insn): Rename to ... + * haifa-sched.c (haifa_classify_insn): Rename to ... (haifa_classify_rtx): ... this. Improve handling of COND_EXECs, handle PARALLELs by recursing. Use it ... (haifa_classify_insn): ... here. Reimplement. @@ -129,7 +135,7 @@ -fipa-reference): Add or correct doc. Sorted options list for -Os -O, -O2. -2007-11-07 Bernhard Fischer +2007-11-07 Bernhard Fischer PR target/16350 * config.gcc: For arm*b-* define TARGET_BIG_ENDIAN_DEFAULT. @@ -140,7 +146,7 @@ * config/arm/linux-eabi.h (TARGET_LINKER_EMULATION): Set according to TARGET_BIG_ENDIAN_DEFAULT. (SUBTARGET_EXTRA_LINK_SPEC): Likewise. - * gcc/config/arm/bpabi.h (TARGET_DEFAULT_MASK): Set according + * config/arm/bpabi.h (TARGET_DEFAULT_MASK): Set according to TARGET_BIG_ENDIAN_DEFAULT. 2007-11-07 Diego Novillo @@ -3281,12 +3287,12 @@ * config/m68k/m68k.md (cmp, cmp_68881, cmp_cf): Cleanup predicates to relieve reload. (conditional_trap): Reject conditional trap with fp condition. - * gcc/config/m68k/predicates.md (fp_src_operand): New, reject + * config/m68k/predicates.md (fp_src_operand): New, reject certain constants early. 2007-09-24 Roman Zippel - * gcc/final.c (final_scan_insn): Remove accidentally duplicated code. + * final.c (final_scan_insn): Remove accidentally duplicated code. 2007-09-24 Andrew Pinski @@ -3507,16 +3513,16 @@ 2007-09-19 Michael Meissner - * gcc/config/i386/i386.c: Delete trailing whitespace. - * gcc/config/i386/i386.h: Ditto. - * gcc/config/i386/bmmintrin.h: Ditto. - * gcc/config/i386/sync.md: Ditto. - * gcc/config/i386/ppro.md: Ditto. - * gcc/config/i386/mmx.md: Ditto. - * gcc/config/i386/constraints.md: Ditto. - * gcc/config/i386/sse.md: Ditto. - * gcc/config/i386/athlon.md: Ditto. - * gcc/config/i386/i386.md: Ditto. + * config/i386/i386.c: Delete trailing whitespace. + * config/i386/i386.h: Ditto. + * config/i386/bmmintrin.h: Ditto. + * config/i386/sync.md: Ditto. + * config/i386/ppro.md: Ditto. + * config/i386/mmx.md: Ditto. + * config/i386/constraints.md: Ditto. + * config/i386/sse.md: Ditto. + * config/i386/athlon.md: Ditto. + * config/i386/i386.md: Ditto. 2007-09-21 Richard Guenther @@ -5135,13 +5141,13 @@ 2007-09-10 Uros Bizjak PR target/33369 - * gcc/config/i386/sse.md (ashr3): Change op2 mode to SImode. + * config/i386/sse.md (ashr3): Change op2 mode to SImode. Use 'N' operand constraint for op2. (lshr3): Ditto. (ashl3): Ditto. (vec_shl_): Use const_0_to_255_mul_8_operand predicate for op2. (vec_shr_): Ditto. - * gcc/config/i386/i386.c (ix86_expand_builtin) [IX86_BUILTIN_PSLL?128, + * config/i386/i386.c (ix86_expand_builtin) [IX86_BUILTIN_PSLL?128, IX86_BUILTIN_PSRA*?128, IX86_BUILTIN_PSRL?128]: Convert op1 to SImode. 2007-09-10 Andreas Krebbel @@ -6214,8 +6220,8 @@ 2007-09-05 Uros Bizjak - * gcc/config/i386/cpuid.h: New file. - * gcc/config/i386/driver-i386.c: Include cpuid.h. + * config/i386/cpuid.h: New file. + * config/i386/driver-i386.c: Include cpuid.h. (describe_cache): Shrink size and line strings to 100 bytes. (detect_caches_amd): Return "" for unsupported max_ext_level. Use __cpuid function. @@ -6235,12 +6241,12 @@ [PROCESSOR_K8]: Add k8-sse3 architecture. [PROCESSOR_NOCONA]: Remove. [PROCESSOR_GENERIC64]: Ditto. - * gcc/config/i386/x-i386 (driver-i386.o): Depend on cpuid.h. - * gcc/config/i386/crtfastmath.c: Include cpuid.h. Use __get_cpuid + * config/i386/x-i386 (driver-i386.o): Depend on cpuid.h. + * config/i386/crtfastmath.c: Include cpuid.h. Use __get_cpuid to check for SSE and FXSAVE support. - * gcc/config/i386/t-crtfm (crtfastmath.o): Depend on cpuid.h. + * config/i386/t-crtfm (crtfastmath.o): Depend on cpuid.h. Add -minline-all-stringops. - * gcc/config.gcc (i[34567]86-*-*): Add cpuid.h to extra_headers. + * config.gcc (i[34567]86-*-*): Add cpuid.h to extra_headers. (x86_64-*-*): Ditto. 2007-09-05 Jie Zhang @@ -7185,8 +7191,8 @@ 2007-08-29 Francois-Xavier Coudert - * gcc/builtin-types.def (BT_FN_PTR_PTR_SIZE): New type. - * gcc/builtins.def (BUILT_IN_REALLOC): New builtin. + * builtin-types.def (BT_FN_PTR_PTR_SIZE): New type. + * builtins.def (BUILT_IN_REALLOC): New builtin. 2007-08-29 Douglas Gregor @@ -7255,11 +7261,11 @@ 2007-08-28 Nathan Sidwell Kazu Hirata - * gcc/config/m68k/linux.h + * config/m68k/linux.h (M68K_HONOR_TARGET_STRICT_ALIGNMENT): Redefine as 0. * config/m68k/m68k.c (TARGET_RETURN_IN_MEMORY): New. (m68k_return_in_memory): New. - * gcc/config/m68k/m68k.h (M68K_HONOR_TARGET_STRICT_ALIGNMENT): + * config/m68k/m68k.h (M68K_HONOR_TARGET_STRICT_ALIGNMENT): New. 2007-08-28 Uros Bizjak @@ -9031,7 +9037,7 @@ * params.def (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS): Rename. (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS): Define. - * gcc/doc/invoke.texi + * doc/invoke.texi (vect-max-version-for-alignment-checks): Document. (vect-max-version-for-alias-checks): Document. (vect-max-version-checks): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8c1b2b3f86e..8e1a0b5b5ee4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2007-11-10 Jakub Jelinek + PR tree-optimization/33680 + * gcc.c-torture/compile/20071108-1.c: New test. + PR c++/32241 * g++.dg/template/pseudodtor3.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/20071108-1.c b/gcc/testsuite/gcc.c-torture/compile/20071108-1.c new file mode 100644 index 000000000000..b9a36ef65a7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20071108-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/33680 */ + +int +f (int dim, int *b, int *c) +{ + int newcentroid[3][dim]; + int *a = newcentroid[2]; + int i, dist = 0; + __builtin_memcpy (newcentroid, c, sizeof (newcentroid)); + for (i = 0; i < dim; i++) + dist += (a[i] - b[i]) * (a[i] - b[i]); + return dist; +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index bf7d2ab6aea0..8d9c4c98a55c 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -560,7 +560,27 @@ split_constant_offset (tree exp, tree *var, tree *off) fold_convert (TREE_TYPE (base), poffset)); } - *var = fold_convert (type, base); + var0 = fold_convert (type, base); + + /* If variable length types are involved, punt, otherwise casts + might be converted into ARRAY_REFs in gimplify_conversion. + To compute that ARRAY_REF's element size TYPE_SIZE_UNIT, which + possibly no longer appears in current GIMPLE, might resurface. + This perhaps could run + if (TREE_CODE (var0) == NOP_EXPR + || TREE_CODE (var0) == CONVERT_EXPR) + { + gimplify_conversion (&var0); + // Attempt to fill in any within var0 found ARRAY_REF's + // element size from corresponding op embedded ARRAY_REF, + // if unsuccessful, just punt. + } */ + while (POINTER_TYPE_P (type)) + type = TREE_TYPE (type); + if (int_size_in_bytes (type) < 0) + break; + + *var = var0; *off = off0; return; }