diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-15 15:07:46 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-15 15:07:46 +0000 |
commit | f06537f281ee377a580745324c3dcb4dd0061e81 (patch) | |
tree | 0bcb9d1a50290f889709fe4909b9f2295332dc22 /gcc/c-common.c | |
parent | 890c45fff2c369be2a2cfffa169ea8642000464d (diff) | |
download | gcc-f06537f281ee377a580745324c3dcb4dd0061e81.tar.gz |
2008-07-15 Richard Guenther <rguenther@suse.de>
PR middle-end/36369
* c-common.c (strict_aliasing_warning): Do not warn for
TYPE_REF_CAN_ALIAS_ALL pointers.
(c_common_get_alias_set): may_alias types are not special.
* tree.c (build_pointer_type_for_mode): Look up the may_alias
attribute and set can_ref_all accordingly.
(build_reference_type_for_mode): Likewise.
* doc/extend.texi (may_alias): Clarify.
* gcc.dg/Wstrict-aliasing-bogus-ref-all.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 1af2120f84b..e93d2fba6df 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1242,8 +1242,13 @@ warn_logical_operator (enum tree_code code, tree arg1, tree bool strict_aliasing_warning (tree otype, tree type, tree expr) { - if (!(flag_strict_aliasing && POINTER_TYPE_P (type) - && POINTER_TYPE_P (otype) && !VOID_TYPE_P (TREE_TYPE (type)))) + if (!(flag_strict_aliasing + && POINTER_TYPE_P (type) + && POINTER_TYPE_P (otype) + && !VOID_TYPE_P (TREE_TYPE (type))) + /* If the type we are casting to is a ref-all pointer + dereferencing it is always valid. */ + || TYPE_REF_CAN_ALIAS_ALL (type)) return false; if ((warn_strict_aliasing > 1) && TREE_CODE (expr) == ADDR_EXPR @@ -3464,10 +3469,6 @@ c_common_get_alias_set (tree t) || t == unsigned_char_type_node) return 0; - /* If it has the may_alias attribute, it can alias anything. */ - if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (t))) - return 0; - /* The C standard specifically allows aliasing between signed and unsigned variants of the same type. We treat the signed variant as canonical. */ |