diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2005-03-16 16:25:47 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@gcc.gnu.org> | 2005-03-16 16:25:47 +0000 |
commit | 5f6c8a56a726b191f7a603caa0b7dc65f2e3e5bf (patch) | |
tree | 7eb8e3be798ca8c365afb184477ef01de61338df | |
parent | f718710e8da82c6987d02a28461a8b32b4e0afb2 (diff) | |
download | gcc-5f6c8a56a726b191f7a603caa0b7dc65f2e3e5bf.zip gcc-5f6c8a56a726b191f7a603caa0b7dc65f2e3e5bf.tar.gz gcc-5f6c8a56a726b191f7a603caa0b7dc65f2e3e5bf.tar.bz2 |
re PR tree-optimization/20489 (ICE: address taken, but ADDRESSABLE bit not set)
2005-03-16 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/20489
* tree-ssa-alias.c (push_fields_onto_fieldstack): DTRT
for empty structures.
From-SVN: r96562
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/pr20489.C | 22 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 13 |
3 files changed, 42 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbb663e..0714aee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,11 @@ 2005-03-16 Daniel Berlin <dberlin@dberlin.org> + + Fix PR tree-optimization/20489 + + * tree-ssa-alias.c (push_fields_onto_fieldstack): DTRT + for empty structures. + +2005-03-16 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/20490 diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr20489.C b/gcc/testsuite/g++.dg/tree-ssa/pr20489.C new file mode 100644 index 0000000..0a1a569 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr20489.C @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct A +{ + ~A(); +}; + +/* If we don't create SFT's for the "empty" structure A, bad things + will happen, and we will fail verification. */ +struct B +{ + int i; + A a; + + void foo() {} +}; + +void bar() +{ + B().foo(); +} diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e38a8c2..315463f 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -2729,8 +2729,21 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_t) **fieldstack, continue; if (var_can_have_subvars (field)) { + size_t before = VEC_length (fieldoff_t, *fieldstack); push_fields_onto_fieldstack (TREE_TYPE (field), fieldstack, offset + bitpos_of_field (field)); + /* Empty structures may have actual size, like in C++. So see if we + actually end up pushing a field, and if not, if the size is non-zero, + push the field onto the stack */ + if (before == VEC_length (fieldoff_t, *fieldstack) + && DECL_SIZE (field) + && !integer_zerop (DECL_SIZE (field))) + { + pair = xmalloc (sizeof (struct fieldoff)); + pair->field = field; + pair->offset = offset + bitpos_of_field (field); + VEC_safe_push (fieldoff_t, *fieldstack, pair); + } } else { |