Index: c-common.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/c-common.c,v retrieving revision 1.653 diff -u -p -r1.653 c-common.c --- c-common.c 27 Sep 2005 16:04:06 -0000 1.653 +++ c-common.c 30 Sep 2005 17:46:42 -0000 @@ -2668,9 +2668,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 Index: alias.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/alias.c,v retrieving revision 1.254 diff -u -p -r1.254 alias.c --- alias.c 21 Jul 2005 22:34:33 -0000 1.254 +++ alias.c 30 Sep 2005 17:46:42 -0000 @@ -587,6 +587,10 @@ get_alias_set (tree t) /* Now all we care about is the type. */ t = TREE_TYPE (t); } + + /* If it has the may_alias attribute, it can alias anything. */ + if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (t))) + return 0; /* Variant qualifiers don't affect the alias set, so get the main variant. If this is a type with a known alias set, return it. */ Index: tree.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree.c,v retrieving revision 1.505 diff -u -p -r1.505 tree.c --- tree.c 14 Sep 2005 15:04:56 -0000 1.505 +++ tree.c 30 Sep 2005 17:46:42 -0000 @@ -4705,6 +4705,17 @@ build_pointer_type_for_mode (tree to_typ if (to_type == error_mark_node) return error_mark_node; + + if (can_alias_all) + { + to_type = + build_type_attribute_variant (ttype, + merge_attributes + (TYPE_ATTRIBUTES (to_type), + tree_cons (get_identifier ("may_alias"), + NULL_TREE, NULL_TREE))); + + } /* 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. @@ -4721,14 +4732,13 @@ build_pointer_type_for_mode (tree to_typ /* First, if we already have a type for pointers to TO_TYPE and it's the proper mode, use it. */ for (t = TYPE_POINTER_TO (to_type); t; t = TYPE_NEXT_PTR_TO (t)) - if (TYPE_MODE (t) == mode && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all) + if (TYPE_MODE (t) == mode) return t; t = make_node (POINTER_TYPE); TREE_TYPE (t) = to_type; TYPE_MODE (t) = mode; - TYPE_REF_CAN_ALIAS_ALL (t) = can_alias_all; TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (to_type); TYPE_POINTER_TO (to_type) = t; @@ -4754,6 +4764,18 @@ build_reference_type_for_mode (tree to_t bool can_alias_all) { tree t; + + + if (can_alias_all) + { + to_type = + build_type_attribute_variant (ttype, + merge_attributes + (TYPE_ATTRIBUTES (to_type), + tree_cons (get_identifier ("may_alias"), + NULL_TREE, NULL_TREE))); + + } /* 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. @@ -4770,14 +4792,13 @@ build_reference_type_for_mode (tree to_t /* First, if we already have a type for pointers to TO_TYPE and it's the proper mode, use it. */ for (t = TYPE_REFERENCE_TO (to_type); t; t = TYPE_NEXT_REF_TO (t)) - if (TYPE_MODE (t) == mode && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all) + if (TYPE_MODE (t) == mode) return t; t = make_node (REFERENCE_TYPE); TREE_TYPE (t) = to_type; TYPE_MODE (t) = mode; - TYPE_REF_CAN_ALIAS_ALL (t) = can_alias_all; TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (to_type); TYPE_REFERENCE_TO (to_type) = t; @@ -4809,12 +4830,12 @@ build_type_no_quals (tree t) case POINTER_TYPE: return build_pointer_type_for_mode (build_type_no_quals (TREE_TYPE (t)), TYPE_MODE (t), - TYPE_REF_CAN_ALIAS_ALL (t)); + false); case REFERENCE_TYPE: return build_reference_type_for_mode (build_type_no_quals (TREE_TYPE (t)), TYPE_MODE (t), - TYPE_REF_CAN_ALIAS_ALL (t)); + false); default: return TYPE_MAIN_VARIANT (t); }