diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-12 10:59:27 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-12 10:59:27 +0000 |
commit | 65a7c5264512fc06d765acae85429103240e6715 (patch) | |
tree | b0465a3073a9f4f3860f76293fb3d13b4ca9868a | |
parent | c87aac54606cd98f51ddc213e4bfee7b8e33eb13 (diff) | |
download | gcc-65a7c5264512fc06d765acae85429103240e6715.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105293 138bc75d-0d04-0410-961f-82ee72b054a4
-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 5b300b1dc5b..f7ce0153c91 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 a544cfa392d..53a5cb0cbec 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 35e7cb99d6c..3f56652f045 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 aec80a3f294..7b81abf5aee 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 2fcbdb76441..51b811947ff 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 00000000000..c3fc6790a2f --- /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" } +}; |