diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-10-12 10:59:27 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-10-12 10:59:27 +0000 |
commit | dbe91deb9a7ab4b7952a2ae7e897e92b9b90915a (patch) | |
tree | b0465a3073a9f4f3860f76293fb3d13b4ca9868a /gcc | |
parent | 25c5165b9a7d1a9247c461e4e90dee53ae6e099f (diff) | |
download | gcc-dbe91deb9a7ab4b7952a2ae7e897e92b9b90915a.zip gcc-dbe91deb9a7ab4b7952a2ae7e897e92b9b90915a.tar.gz gcc-dbe91deb9a7ab4b7952a2ae7e897e92b9b90915a.tar.bz2 |
re PR c++/19964 (ICE on invalid member declaration)
PR c++/19964
* stor-layout.c (place_field): Set DECL_FIELD_OFFSET and
DECL_FIELD_BIT_OFFSET of FIELD_DECLs, even if they have an invalid
type.
cp:
PR c++/19964
* cp/class.c (walk_subobject_offsets): Don't walk error_mark_node.
testsuite:
PR c++/19964
* g++.dg/parse/crash31.C: New.
From-SVN: r105293
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/class.c | 3 | ||||
-rw-r--r-- | gcc/stor-layout.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/crash31.C | 9 |
6 files changed, 42 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b300b1..f7ce015 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-10-12 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/19964 + * stor-layout.c (place_field): Set DECL_FIELD_OFFSET and + DECL_FIELD_BIT_OFFSET of FIELD_DECLs, even if they have an invalid + type. + 2005-10-12 Richard Guenther <rguenther@suse.de> PR c++/23799 @@ -39,6 +46,7 @@ Only apply the optimization for rounding builtins if the inner cast is also an extension. +>>>>>>> 2.10143 2005-10-11 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/23946 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a544cfa..53a5cb0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-10-12 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/19964 + * cp/class.c (walk_subobject_offsets): Don't walk error_mark_node. + 2005-10-11 Ian Lance Taylor <ian@airs.com> PR c++/8057 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 35e7cb9..3f56652f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3101,6 +3101,9 @@ walk_subobject_offsets (tree type, if (max_offset && INT_CST_LT (max_offset, offset)) return 0; + if (type == error_mark_node) + return 0; + if (!TYPE_P (type)) { if (abi_version_at_least (2)) diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index aec80a3..7b81abf 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -800,9 +800,19 @@ place_field (record_layout_info rli, tree field) /* The type of this field. */ tree type = TREE_TYPE (field); - if (TREE_CODE (field) == ERROR_MARK || TREE_CODE (type) == ERROR_MARK) - return; + gcc_assert (TREE_CODE (field) != ERROR_MARK); + if (TREE_CODE (type) == ERROR_MARK) + { + if (TREE_CODE (field) == FIELD_DECL) + { + DECL_FIELD_OFFSET (field) = size_int (0); + DECL_FIELD_BIT_OFFSET (field) = bitsize_int (0); + } + + return; + } + /* If FIELD is static, then treat it like a separate variable, not really like a structure field. If it is a FUNCTION_DECL, it's a method. In both cases, all we do is lay out the decl, and we do diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2fcbdb7..51b8119 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-12 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/19964 + * g++.dg/parse/crash31.C: New. + 2005-10-12 Razya Ladelsky <razya@il.ibm.com> * g++.dg/ipa/ipa-1.c: New test. diff --git a/gcc/testsuite/g++.dg/parse/crash31.C b/gcc/testsuite/g++.dg/parse/crash31.C new file mode 100644 index 0000000..c3fc679 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash31.C @@ -0,0 +1,9 @@ +struct A +{ // { dg-error "forward declaration" } + A : A; // { dg-error "expected|incomplete" } + A : B; // { dg-error "not declared|incomplete" } + A : A(); // { dg-error "undefined type|incomplete" } + A : B(); // { dg-error "function call|incomplete" } + A : A[]; // { dg-error "expected|array reference|incomplete" } + A : B[]; // { dg-error "not declared|expected|array reference|incomplete" } +}; |