summaryrefslogtreecommitdiff
path: root/gcc/c-gimplify.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-09 08:07:31 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-09 08:07:31 +0000
commitd7dfb761b44aa11c2c26021d01e73acc18ae970d (patch)
treec27706ee771d0ae8550beb8fc38fe98f547e8e9a /gcc/c-gimplify.c
parent87c5de3bcdc3fe3963bf57af231808fb7786db28 (diff)
downloadgcc-d7dfb761b44aa11c2c26021d01e73acc18ae970d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145800 138bc75d-0d04-0410-961f-82ee72b054a4
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 9cb4a0b2d17..cf06974c53a 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;
}