summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-15 03:09:50 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-15 03:09:50 +0000
commit4e768ca79a69fb9f8fb80b4e26e4332df89de2e7 (patch)
tree8ddc3fce146e31931ab600c4c4208ee2f443eb04 /gcc/gimplify.c
parent1392b15e20d7c483d8ea8233fa2945dd6f89abe7 (diff)
downloadgcc-4e768ca79a69fb9f8fb80b4e26e4332df89de2e7.tar.gz
gcc/ChangeLog:
PR middle-end/20739 * gimplify.c (gimplify_addr_expr): Compensate for removal of e.g. cv-qualification conversions. gcc/testsuite/ChangeLog: PR middle-end/20739 * gcc.dg/tree-ssa/pr20739.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98167 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 23713df01de..5eb1d49bd1c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3229,6 +3229,9 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
builtins like __builtin_va_end). */
/* Caution: the silent array decomposition semantics we allow for
ADDR_EXPR means we can't always discard the pair. */
+ /* Gimplification of the ADDR_EXPR operand may drop
+ cv-qualification conversions, so make sure we add them if
+ needed. */
{
tree op00 = TREE_OPERAND (op0, 0);
tree t_expr = TREE_TYPE (expr);
@@ -3238,9 +3241,9 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
{
#ifdef ENABLE_CHECKING
tree t_op0 = TREE_TYPE (op0);
- gcc_assert (TREE_CODE (t_op0) == ARRAY_TYPE
- && POINTER_TYPE_P (t_expr)
- && cpt_same_type (TREE_TYPE (t_op0),
+ gcc_assert (POINTER_TYPE_P (t_expr)
+ && cpt_same_type (TREE_CODE (t_op0) == ARRAY_TYPE
+ ? TREE_TYPE (t_op0) : t_op0,
TREE_TYPE (t_expr))
&& POINTER_TYPE_P (t_op00)
&& cpt_same_type (t_op0, TREE_TYPE (t_op00)));