aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-gimplify.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-04-09 08:07:31 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-04-09 08:07:31 +0000
commit22a65a54cc52c1e2081ef202523cce5505f6d85b (patch)
treec27706ee771d0ae8550beb8fc38fe98f547e8e9a /gcc/c-gimplify.c
parentf76968e6d5ab3ca8bd5b64ba0143197c00f59943 (diff)
downloadgcc-22a65a54cc52c1e2081ef202523cce5505f6d85b.zip
gcc-22a65a54cc52c1e2081ef202523cce5505f6d85b.tar.gz
gcc-22a65a54cc52c1e2081ef202523cce5505f6d85b.tar.bz2
c-gimplify.c (c_gimplify_expr): Fix the invalid GENERIC &ARRAY addresses by adjusting their types and...
2009-04-09 Richard Guenther <rguenther@suse.de> * c-gimplify.c (c_gimplify_expr): Fix the invalid GENERIC &ARRAY addresses by adjusting their types and prepending a conversion. * tree-cfg.c (verify_gimple_assign_single): Verify that addresses are correct. * gcc.dg/vect/vect-54.c: Make constant input data file-scope to prevent constant propagation. * gcc.dg/vect/vect-56.c: Likewise. * gcc.dg/vect/vect-58.c: Likewise. * gcc.dg/vect/vect-60.c: Likewise. * gcc.dg/vect/no-vfa-vect-57.c: Likewise. * gcc.dg/vect/no-vfa-vect-61.c: Likewise. * gcc.dg/tree-prof/stringop-2.c: Adjust expected outcome. From-SVN: r145800
Diffstat (limited to 'gcc/c-gimplify.c')
-rw-r--r--gcc/c-gimplify.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index 9cb4a0b..cf06974 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -196,5 +196,19 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
&& !warn_init_self)
TREE_NO_WARNING (DECL_EXPR_DECL (*expr_p)) = 1;
+ /* The C frontend is the only one producing &ARRAY with pointer-to-element
+ type. This is invalid in gimple, so produce a properly typed
+ ADDR_EXPR instead and wrap a conversion around it. */
+ if (code == ADDR_EXPR
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (*expr_p))) != ARRAY_TYPE)
+ {
+ tree type = TREE_TYPE (*expr_p);
+ TREE_TYPE (*expr_p)
+ = build_pointer_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0)));
+ *expr_p = build1 (NOP_EXPR, type, *expr_p);
+ return GS_OK;
+ }
+
return GS_UNHANDLED;
}