Commit 84894f85 by Dodji Seketeli Committed by Dodji Seketeli

re PR c++/42217 (ICE with zero-length bit-field)

Fix PR c++/42217

gcc/cp/ChangeLog
	PR c++/42217
	* class.c (remove_zero_width_bit_fields): The width of the bit field is
	in DECL_SIZE, not in DECL_INITIAL.

gcc/testsuite/ChangeLog
	PR c++/42217
	* g++.dg/other/bitfield4.C: New test.

From-SVN: r154938
parent 249ccaff
2009-12-03 Dodji Seketeli <dodji@redhat.com>
PR c++/42217
* class.c (remove_zero_width_bit_fields): The width of the bit field is
in DECL_SIZE, not in DECL_INITIAL.
2009-12-03 Jakub Jelinek <jakub@redhat.com>
PR c++/42256
......
......@@ -4254,7 +4254,12 @@ remove_zero_width_bit_fields (tree t)
{
if (TREE_CODE (*fieldsp) == FIELD_DECL
&& DECL_C_BIT_FIELD (*fieldsp)
&& DECL_INITIAL (*fieldsp))
/* We should not be confused by the fact that grokbitfield
temporarily sets the width of the bit field into
DECL_INITIAL (*fieldsp).
check_bitfield_decl eventually sets DECL_SIZE (*fieldsp)
to that width. */
&& integer_zerop (DECL_SIZE (*fieldsp)))
*fieldsp = TREE_CHAIN (*fieldsp);
else
fieldsp = &TREE_CHAIN (*fieldsp);
......
2009-12-03 Dodji Seketeli <dodji@redhat.com>
PR c++/42217
* g++.dg/other/bitfield4.C: New test.
2009-12-03 Jakub Jelinek <jakub@redhat.com>
PR c++/42256
......
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/42217
// { dg-do compile }
struct A
{
int : 0;
};
A a = A();
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