Commit 26d40c3d by Jason Merrill Committed by Jason Merrill

re PR c++/57793 (ICE with bitfields in get_bit_range)

	PR c++/57793
c/
	* c-decl.c (finish_struct): Check for too-large class.
cp/
	* class.c (layout_class_type): Check for too-large class.

From-SVN: r200938
parent 53db1bc0
2013-07-13 Jason Merrill <jason@redhat.com>
PR c++/57793
* c-decl.c (finish_struct): Check for too-large class.
2013-07-04 Joern Rennecke <joern.rennecke@embecosm.com>
PR c/57821
......
......@@ -7210,6 +7210,12 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
layout_type (t);
if (TYPE_SIZE_UNIT (t)
&& TREE_CODE (TYPE_SIZE_UNIT (t)) == INTEGER_CST
&& !TREE_OVERFLOW (TYPE_SIZE_UNIT (t))
&& !valid_constant_size_p (TYPE_SIZE_UNIT (t)))
error ("type %qT is too large", t);
/* Give bit-fields their proper types. */
{
tree *fieldlistp = &fieldlist;
......
2013-07-13 Jason Merrill <jason@redhat.com>
PR c++/57793
* class.c (layout_class_type): Check for too-large class.
* call.c (can_convert): Allow user-defined conversions.
(can_convert_standard): New.
* cp-tree.h: Declare it.
......
......@@ -6237,6 +6237,12 @@ layout_class_type (tree t, tree *virtuals_p)
/* Let the back end lay out the type. */
finish_record_layout (rli, /*free_p=*/true);
if (TYPE_SIZE_UNIT (t)
&& TREE_CODE (TYPE_SIZE_UNIT (t)) == INTEGER_CST
&& !TREE_OVERFLOW (TYPE_SIZE_UNIT (t))
&& !valid_constant_size_p (TYPE_SIZE_UNIT (t)))
error ("type %qT is too large", t);
/* Warn about bases that can't be talked about due to ambiguity. */
warn_about_ambiguous_bases (t);
......
/* PR c++/57793 */
struct A { unsigned a : 1; unsigned b : 1; };
struct B /* { dg-error "type .B. is too large" "" { target { c++ && ilp32 } } } */
{
unsigned char c[0x40000000];
unsigned char d[0x40000ff0];
struct A e;
}; /* { dg-error "type .struct B. is too large" "" { target { c && ilp32 } } } */
void *foo (struct B *p)
{
if (p->e.a)
return (void *) 0;
p->e.b = 1;
return p->c;
}
void
bar (struct B *p)
{
foo (p);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment