From 836f779495e3468c959fbcc2ea1cbcee17d50dba Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 2 Jul 2007 20:01:32 +0000 Subject: 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 --- gcc/ChangeLog | 9 +++++++++ gcc/alias.c | 22 ++++++++-------------- gcc/c-common.c | 4 ++-- gcc/tree.h | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ef7b32..6f58379 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2007-07-02 Eric Botcazou + + * 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 * rtlhooks.c (gen_lowpart_if_possible): Check for diff --git a/gcc/alias.c b/gcc/alias.c index 8064b8e..7c258c7 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -320,11 +320,8 @@ alias_sets_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2) { alias_set_entry ase; - /* If have no alias set information for one of the operands, we have - to assume it can alias anything. */ - if (set1 == 0 || set2 == 0 - /* If the two alias sets are the same, they may alias. */ - || set1 == set2) + /* The easy case. */ + if (alias_sets_must_conflict_p (set1, set2)) return 1; /* 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) return 1; /* 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 1 if the two specified alias sets might conflict, or if any subtype - of these alias sets might conflict. */ +/* Return 1 if the two specified alias sets will always conflict. */ 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) return 1; @@ -360,7 +356,6 @@ alias_sets_might_conflict_p (HOST_WIDE_INT set1, HOST_WIDE_INT set2) return 0; } - /* 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. 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) set1 = t1 ? get_alias_set (t1) : 0; set2 = t2 ? get_alias_set (t2) : 0; - /* Otherwise they conflict if they have no alias set or the same. We - can't simply use alias_sets_conflict_p here, because we must make - sure that every subtype of t1 will conflict with every subtype of + /* We can't use alias_sets_conflict_p because we must make sure + that every subtype of t1 will conflict with every subtype of t2 for which a pair of subobjects of these respective subtypes 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 diff --git a/gcc/c-common.c b/gcc/c-common.c index 5243dd7..b1c20a6 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1050,7 +1050,7 @@ strict_aliasing_warning (tree otype, tree type, tree expr) return true; } 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 " "pointer might break strict-aliasing rules"); @@ -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 set2 = get_alias_set (TREE_TYPE (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 " "pointer might break strict-aliasing rules"); diff --git a/gcc/tree.h b/gcc/tree.h index 942ab5f..a28f20b 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4565,7 +4565,7 @@ extern tree strip_float_extensions (tree); extern void record_component_aliases (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_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); /* In tree.c */ -- cgit v1.1