diff options
author | Jim Wilson <wilson@cygnus.com> | 1998-10-29 12:40:21 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1998-10-29 04:40:21 -0800 |
commit | 1e2800358a9df1c5379e7bd66b9858b452742cb6 (patch) | |
tree | 0d5b5580e33ba64992935ec77074119a7e004988 /gcc/c-common.c | |
parent | 7140b0dba6389942f7dd33e4629fe85a5df7db52 (diff) | |
download | gcc-1e2800358a9df1c5379e7bd66b9858b452742cb6.zip gcc-1e2800358a9df1c5379e7bd66b9858b452742cb6.tar.gz gcc-1e2800358a9df1c5379e7bd66b9858b452742cb6.tar.bz2 |
Fix for sparc va_arg macro aliasing problem.
* c-common.c (c_get_alias_set): Handle ARRAY_REF of union field.
From-SVN: r23427
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 508a8c2..ddb87cd 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3155,8 +3155,15 @@ c_get_alias_set (t) the conservative assumption. */ return 0; - if (TREE_CODE (t) == COMPONENT_REF - && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == UNION_TYPE) + if ((TREE_CODE (t) == COMPONENT_REF + && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == UNION_TYPE) + /* Also permit punning when accessing an array which is a union + member. This makes the current sparc va_arg macro work, but may + not be otherwise necessary. */ + || (TREE_CODE (t) == ARRAY_REF + && TREE_CODE (TREE_OPERAND (t, 0)) == COMPONENT_REF + && (TREE_CODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0))) + == UNION_TYPE))) /* 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 |