diff options
author | Jason Merrill <jason@redhat.com> | 2006-08-29 02:55:03 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2006-08-29 02:55:03 -0400 |
commit | bed02d89608838750eac5b389e91b2678c72d55d (patch) | |
tree | d610e5b2cb788508832762326b280dc332edea2e /gcc | |
parent | d218d0e66d1144e1a727c13fb0586c82b4fc3d87 (diff) | |
download | gcc-bed02d89608838750eac5b389e91b2678c72d55d.zip gcc-bed02d89608838750eac5b389e91b2678c72d55d.tar.gz gcc-bed02d89608838750eac5b389e91b2678c72d55d.tar.bz2 |
re PR c++/26577 (ICE in cp_expr_size with volatile and non POD)
PR c++/26577
* cvt.c (convert_to_void): Don't automatically load from volatiles
of TREE_ADDRESSABLE type.
From-SVN: r116554
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/volatile1.C | 12 |
3 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f16a801..b8cc3ba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-28 Jason Merrill <jason@redhat.com> + + PR c++/26577 + * cvt.c (convert_to_void): Don't automatically load from volatiles + of TREE_ADDRESSABLE type. + 2006-08-28 Volker Reichelt <reichelt@igpm.rwth-aachen.de> PR c++/28860 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 902372e..710bc74 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -864,14 +864,17 @@ convert_to_void (tree expr, const char *implicit) int is_volatile = TYPE_VOLATILE (type); int is_complete = COMPLETE_TYPE_P (complete_type (type)); + /* Can't load the value if we don't know the type. */ if (is_volatile && !is_complete) warning (0, "object of incomplete type %qT will not be accessed in %s", type, implicit ? implicit : "void context"); - else if (is_reference && is_volatile) + /* Don't load the value if this is an implicit dereference, or if + the type needs to be handled by ctors/dtors. */ + else if (is_volatile && (is_reference || TREE_ADDRESSABLE (type))) warning (0, "object of type %qT will not be accessed in %s", TREE_TYPE (TREE_OPERAND (expr, 0)), implicit ? implicit : "void context"); - if (is_reference || !is_volatile || !is_complete) + if (is_reference || !is_volatile || !is_complete || TREE_ADDRESSABLE (type)) expr = TREE_OPERAND (expr, 0); break; diff --git a/gcc/testsuite/g++.dg/warn/volatile1.C b/gcc/testsuite/g++.dg/warn/volatile1.C new file mode 100644 index 0000000..5b1050f --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/volatile1.C @@ -0,0 +1,12 @@ +// PR c++/26577 + +struct A +{ + A(const A&); + A& operator=(const A&); + void baz() volatile; +}; +void A::baz() volatile +{ + *this; // { dg-warning "will not be accessed" } +} |