aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2005-10-12 10:59:27 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2005-10-12 10:59:27 +0000
commitdbe91deb9a7ab4b7952a2ae7e897e92b9b90915a (patch)
treeb0465a3073a9f4f3860f76293fb3d13b4ca9868a /gcc/stor-layout.c
parent25c5165b9a7d1a9247c461e4e90dee53ae6e099f (diff)
downloadgcc-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/stor-layout.c')
-rw-r--r--gcc/stor-layout.c14
1 files changed, 12 insertions, 2 deletions
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