aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-06-20 00:30:04 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-06-20 00:30:04 -0700
commit74d86f4fc1c5966e88f0cf977e33bb26c0cd643e (patch)
tree0c4e881b9c304c27324e19124ed29268823cef27 /gcc/c-common.c
parent3b4008995c857e733ea4d998f1228acacc13dafe (diff)
downloadgcc-74d86f4fc1c5966e88f0cf977e33bb26c0cd643e.zip
gcc-74d86f4fc1c5966e88f0cf977e33bb26c0cd643e.tar.gz
gcc-74d86f4fc1c5966e88f0cf977e33bb26c0cd643e.tar.bz2
c-common.c (c_common_get_alias_set): Correctly handle characters.
* c-common.c (c_common_get_alias_set): Correctly handle characters. Rearrange order of expressions; don't handle vectors here. * alias.c (get_alias_set): Let vectors match their components. From-SVN: r54821
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index b477fe7..c71f752 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2527,10 +2527,6 @@ c_common_get_alias_set (t)
{
tree u;
- /* We know nothing about vector types */
- if (TREE_CODE (t) == VECTOR_TYPE)
- return 0;
-
/* Permit type-punning when accessing a union, provided the access
is directly through the union. For example, this code does not
permit taking the address of a union member and then storing
@@ -2544,21 +2540,21 @@ c_common_get_alias_set (t)
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE)
return 0;
- /* If this is a char *, the ANSI C standard says it can alias
- anything. Note that all references need do this. */
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r'
- && TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
- && TYPE_PRECISION (TREE_TYPE (t)) == TYPE_PRECISION (char_type_node))
+ /* That's all the expressions we handle specially. */
+ if (! TYPE_P (t))
+ return -1;
+
+ /* The C standard guarantess that any object may be accessed via an
+ lvalue that has character type. */
+ if (t == char_type_node
+ || t == signed_char_type_node
+ || t == unsigned_char_type_node)
return 0;
/* If it has the may_alias attribute, it can alias anything. */
- if (TYPE_P (t) && lookup_attribute ("may_alias", TYPE_ATTRIBUTES (t)))
+ if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (t)))
return 0;
- /* That's all the expressions we handle specially. */
- if (! TYPE_P (t))
- return -1;
-
/* The C standard specifically allows aliasing between signed and
unsigned variants of the same type. We treat the signed
variant as canonical. */