summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-15 15:07:46 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-15 15:07:46 +0000
commitf06537f281ee377a580745324c3dcb4dd0061e81 (patch)
tree0bcb9d1a50290f889709fe4909b9f2295332dc22 /gcc/tree.c
parent890c45fff2c369be2a2cfffa169ea8642000464d (diff)
downloadgcc-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/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 0bb9fd9367f..6441ae6ef33 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5499,6 +5499,11 @@ build_pointer_type_for_mode (tree to_type, enum machine_mode mode,
if (to_type == error_mark_node)
return error_mark_node;
+ /* If the pointed-to type has the may_alias attribute set, force
+ a TYPE_REF_CAN_ALIAS_ALL pointer to be generated. */
+ if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (to_type)))
+ can_alias_all = true;
+
/* In some cases, languages will have things that aren't a POINTER_TYPE
(such as a RECORD_TYPE for fat pointers in Ada) as TYPE_POINTER_TO.
In that case, return that type without regard to the rest of our
@@ -5555,6 +5560,14 @@ build_reference_type_for_mode (tree to_type, enum machine_mode mode,
{
tree t;
+ if (to_type == error_mark_node)
+ return error_mark_node;
+
+ /* If the pointed-to type has the may_alias attribute set, force
+ a TYPE_REF_CAN_ALIAS_ALL pointer to be generated. */
+ if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (to_type)))
+ can_alias_all = true;
+
/* In some cases, languages will have things that aren't a REFERENCE_TYPE
(such as a RECORD_TYPE for fat pointers in Ada) as TYPE_REFERENCE_TO.
In that case, return that type without regard to the rest of our