Commit 836f7794 by Eric Botcazou Committed by Eric Botcazou

tree.h (alias_sets_might_conflict_p): Rename into alias_sets_must_conflict_p.

	* tree.h (alias_sets_might_conflict_p): Rename into
	alias_sets_must_conflict_p.
	* alias.c (alias_sets_might_conflict_p): Likewise.
	(alias_sets_conflict_p): Use it.
	(objects_must_conflict_p): Likewise.
	* c-common.c (strict_aliasing_warning): Adjust.

From-SVN: r126233
parent f4e9e7fa
2007-07-02 Eric Botcazou <ebotcazou@adacore.com>
* tree.h (alias_sets_might_conflict_p): Rename into
alias_sets_must_conflict_p.
* alias.c (alias_sets_might_conflict_p): Likewise.
(alias_sets_conflict_p): Use it.
(objects_must_conflict_p): Likewise.
* c-common.c (strict_aliasing_warning): Adjust.
2007-07-02 Andrew Pinski <andrew_pinski@playstation.sony.com> 2007-07-02 Andrew Pinski <andrew_pinski@playstation.sony.com>
* rtlhooks.c (gen_lowpart_if_possible): Check for * rtlhooks.c (gen_lowpart_if_possible): Check for
......
...@@ -320,11 +320,8 @@ alias_sets_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2) ...@@ -320,11 +320,8 @@ alias_sets_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2)
{ {
alias_set_entry ase; alias_set_entry ase;
/* If have no alias set information for one of the operands, we have /* The easy case. */
to assume it can alias anything. */ if (alias_sets_must_conflict_p (set1, set2))
if (set1 == 0 || set2 == 0
/* If the two alias sets are the same, they may alias. */
|| set1 == set2)
return 1; return 1;
/* See if the first alias set is a subset of the second. */ /* See if the first alias set is a subset of the second. */
...@@ -344,15 +341,14 @@ alias_sets_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2) ...@@ -344,15 +341,14 @@ alias_sets_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2)
return 1; return 1;
/* The two alias sets are distinct and neither one is the /* The two alias sets are distinct and neither one is the
child of the other. Therefore, they cannot alias. */ child of the other. Therefore, they cannot conflict. */
return 0; return 0;
} }
/* Return 1 if the two specified alias sets might conflict, or if any subtype /* Return 1 if the two specified alias sets will always conflict. */
of these alias sets might conflict. */
int int
alias_sets_might_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2) alias_sets_must_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2)
{ {
if (set1 == 0 || set2 == 0 || set1 == set2) if (set1 == 0 || set2 == 0 || set1 == set2)
return 1; return 1;
...@@ -360,7 +356,6 @@ alias_sets_might_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2) ...@@ -360,7 +356,6 @@ alias_sets_might_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2)
return 0; return 0;
} }
/* Return 1 if any MEM object of type T1 will always conflict (using the /* Return 1 if any MEM object of type T1 will always conflict (using the
dependency routines in this file) with any MEM object of type T2. dependency routines in this file) with any MEM object of type T2.
This is used when allocating temporary storage. If T1 and/or T2 are This is used when allocating temporary storage. If T1 and/or T2 are
...@@ -386,12 +381,11 @@ objects_must_conflict_p (tree t1, tree t2) ...@@ -386,12 +381,11 @@ objects_must_conflict_p (tree t1, tree t2)
set1 = t1 ? get_alias_set (t1) : 0; set1 = t1 ? get_alias_set (t1) : 0;
set2 = t2 ? get_alias_set (t2) : 0; set2 = t2 ? get_alias_set (t2) : 0;
/* Otherwise they conflict if they have no alias set or the same. We /* We can't use alias_sets_conflict_p because we must make sure
can't simply use alias_sets_conflict_p here, because we must make that every subtype of t1 will conflict with every subtype of
sure that every subtype of t1 will conflict with every subtype of
t2 for which a pair of subobjects of these respective subtypes t2 for which a pair of subobjects of these respective subtypes
overlaps on the stack. */ overlaps on the stack. */
return set1 == 0 || set2 == 0 || set1 == set2; return alias_sets_must_conflict_p (set1, set2);
} }
/* T is an expression with pointer type. Find the DECL on which this /* T is an expression with pointer type. Find the DECL on which this
......
...@@ -1050,7 +1050,7 @@ strict_aliasing_warning (tree otype, tree type, tree expr) ...@@ -1050,7 +1050,7 @@ strict_aliasing_warning (tree otype, tree type, tree expr)
return true; return true;
} }
else if (warn_strict_aliasing == 2 else if (warn_strict_aliasing == 2
&& !alias_sets_might_conflict_p (set1, set2)) && !alias_sets_must_conflict_p (set1, set2))
{ {
warning (OPT_Wstrict_aliasing, "dereferencing type-punned " warning (OPT_Wstrict_aliasing, "dereferencing type-punned "
"pointer might break strict-aliasing rules"); "pointer might break strict-aliasing rules");
...@@ -1068,7 +1068,7 @@ strict_aliasing_warning (tree otype, tree type, tree expr) ...@@ -1068,7 +1068,7 @@ strict_aliasing_warning (tree otype, tree type, tree expr)
HOST_WIDE_INT set1 = get_alias_set (TREE_TYPE (otype)); HOST_WIDE_INT set1 = get_alias_set (TREE_TYPE (otype));
HOST_WIDE_INT set2 = get_alias_set (TREE_TYPE (type)); HOST_WIDE_INT set2 = get_alias_set (TREE_TYPE (type));
if (!COMPLETE_TYPE_P(type) if (!COMPLETE_TYPE_P(type)
|| !alias_sets_might_conflict_p (set1, set2)) || !alias_sets_must_conflict_p (set1, set2))
{ {
warning (OPT_Wstrict_aliasing, "dereferencing type-punned " warning (OPT_Wstrict_aliasing, "dereferencing type-punned "
"pointer might break strict-aliasing rules"); "pointer might break strict-aliasing rules");
......
...@@ -4565,7 +4565,7 @@ extern tree strip_float_extensions (tree); ...@@ -4565,7 +4565,7 @@ extern tree strip_float_extensions (tree);
extern void record_component_aliases (tree); extern void record_component_aliases (tree);
extern HOST_WIDE_INT get_alias_set (tree); extern HOST_WIDE_INT get_alias_set (tree);
extern int alias_sets_conflict_p (HOST_WIDE_INT, HOST_WIDE_INT); extern int alias_sets_conflict_p (HOST_WIDE_INT, HOST_WIDE_INT);
extern int alias_sets_might_conflict_p (HOST_WIDE_INT, HOST_WIDE_INT); extern int alias_sets_must_conflict_p (HOST_WIDE_INT, HOST_WIDE_INT);
extern int objects_must_conflict_p (tree, tree); extern int objects_must_conflict_p (tree, tree);
/* In tree.c */ /* In tree.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment