summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c9
-rw-r--r--gcc/testsuite/ChangeLog5
3 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 89aae5f2a33..ba3aab92b99 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-17 Alexandre Oliva <aoliva@redhat.com>
+
+ PR middle-end/20739
+ * gimplify.c (gimplify_addr_expr): Compensate for removal of
+ e.g. cv-qualification conversions.
+
2005-04-16 Gerald Pfeifer <gerald@pfeifer.com>
* doc/install.texi (Specific): Avoid using asterisks in @anchor
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 8c51255cf60..992f546bb76 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3231,6 +3231,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);
@@ -3240,9 +3243,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)));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0510f5d2fad..fb434e68942 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-17 Alexandre Oliva <aoliva@redhat.com>
+
+ PR middle-end/20739
+ * gcc.dg/tree-ssa/pr20739.c: New test.
+
2005-04-16 Mark Mitchell <mark@codesourcery.com>
PR c++/21025