diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-03 03:19:22 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-03 03:19:22 +0000 |
commit | 4bef19cc49ffafbe2c840058c28ef7576d3b67f7 (patch) | |
tree | 80491566ebebc60f4e8ca1eed95ccd44aa7ee361 /gcc/tree-ssa-operands.c | |
parent | 9cc0994e899cf8c8bdb51cd13346829fe9f1af1b (diff) | |
download | gcc-4bef19cc49ffafbe2c840058c28ef7576d3b67f7.tar.gz |
2006-05-02 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/26626
* tree-ssa-structalias.c (compute_points_to_sets): For now, solve
always.
* tree-ssa-operands.c (access_can_touch_variable): Allow
typecasting through union pointers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113493 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r-- | gcc/tree-ssa-operands.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index e979b4ce65a..68613fe9564 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1118,11 +1118,32 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset, { return (struct foos *)&foo; } (taken from 20000623-1.c) + + The docs also say/imply that access through union pointers + is legal (but *not* if you take the address of the union member, + i.e. the inverse), such that you can do + + typedef union { + int d; + } U; + + int rv; + void breakme() + { + U *rv0; + U *pretmp = (U*)&rv; + rv0 = pretmp; + rv0->d = 42; + } + To implement this, we just punt on accesses through union + pointers entirely. */ else if (ref && flag_strict_aliasing && TREE_CODE (ref) != INDIRECT_REF && !MTAG_P (alias) + && (TREE_CODE (base) != INDIRECT_REF + || TREE_CODE (TREE_TYPE (base)) != UNION_TYPE) && !AGGREGATE_TYPE_P (TREE_TYPE (alias)) && TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE && !POINTER_TYPE_P (TREE_TYPE (alias))) |