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
This commit is contained in:
Nathan Sidwell 2005-10-12 10:59:27 +00:00
parent 25c5165b9a
commit dbe91deb9a
6 changed files with 42 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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.

View File

@ -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" }
};