mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 14:01:04 +08:00
re PR tree-optimization/18184 (Tree optimizers ignore pointer modes)
ChangeLog: 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. cp/ChangeLog: 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. From-SVN: r90078
This commit is contained in:
parent
ac8b3d9d72
commit
106f5de5a5
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user