aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-typeck.c4
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-objcp-common.c2
-rw-r--r--gcc/cp/typeck.c6
-rw-r--r--gcc/tree-ssa.c6
6 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 83c68dd..23123f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-04 Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR tree-optimization/18184
+ * c-typeck.c (comptypes): Do not treat pointers of different
+ modes or alias-all flags as equivalent.
+ * tree-ssa.c (tree_ssa_useless_type_conversion_1): Likewise.
+
2004-11-04 Joseph S. Myers <joseph@codesourcery.com>
* doc/gty.texi, doc/makefile.texi, doc/sourcebuild.texi: Don't
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 728e768..723bd5a 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -659,6 +659,10 @@ comptypes (tree type1, tree type2)
protocol qualifiers may be involved. */
if (c_dialect_objc () && (val = objc_comptypes (t1, t2, 0)) >= 0)
break;
+ /* Do not remove mode or aliasing information. */
+ if (TYPE_MODE (t1) != TYPE_MODE (t2)
+ || TYPE_REF_CAN_ALIAS_ALL (t1) != TYPE_REF_CAN_ALIAS_ALL (t2))
+ break;
val = (TREE_TYPE (t1) == TREE_TYPE (t2)
? 1 : comptypes (TREE_TYPE (t1), TREE_TYPE (t2)));
break;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a531bf0..73fba48 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-04 Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR tree-optimization/18184
+ * cp-objcp-common.c (cxx_types_compatible_p): Do not treat pointers
+ of different modes or alias-all flags as equivalent.
+ * typeck.c (comptypes): Likewise.
+
2004-11-04 Giovanni Bajo <giovannibajo@gcc.gnu.org>
DR 49, 100
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index a58549b..9938b98 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -162,6 +162,8 @@ cxx_types_compatible_p (tree x, tree y)
interchangeable. FIXME should we try to replace all references with
pointers? */
if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y)
+ && TYPE_MODE (x) == TYPE_MODE (y)
+ && TYPE_REF_CAN_ALIAS_ALL (x) == TYPE_REF_CAN_ALIAS_ALL (y)
&& same_type_p (TREE_TYPE (x), TREE_TYPE (y)))
return 1;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 325dd56..384b1d1 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1030,11 +1030,13 @@ comptypes (tree t1, tree t2, int strict)
if (!comptypes (TYPE_OFFSET_BASETYPE (t1), TYPE_OFFSET_BASETYPE (t2),
strict & ~COMPARE_REDECLARATION))
return false;
- /* Fall through. */
+ return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
case POINTER_TYPE:
case REFERENCE_TYPE:
- return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
+ return TYPE_MODE (t1) == TYPE_MODE (t2)
+ && TYPE_REF_CAN_ALIAS_ALL (t1) == TYPE_REF_CAN_ALIAS_ALL (t2)
+ && same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
case METHOD_TYPE:
case FUNCTION_TYPE:
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 8002565..0e15eee 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -834,6 +834,9 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
implement the ABI. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type)
+ && TYPE_MODE (inner_type) == TYPE_MODE (outer_type)
+ && TYPE_REF_CAN_ALIAS_ALL (inner_type)
+ == TYPE_REF_CAN_ALIAS_ALL (outer_type)
&& TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
return true;
@@ -841,6 +844,9 @@ tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
so strip conversions that just switch between them. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type)
+ && TYPE_MODE (inner_type) == TYPE_MODE (outer_type)
+ && TYPE_REF_CAN_ALIAS_ALL (inner_type)
+ == TYPE_REF_CAN_ALIAS_ALL (outer_type)
&& lang_hooks.types_compatible_p (TREE_TYPE (inner_type),
TREE_TYPE (outer_type)))
return true;