Commit 43f7bed5 by Vladimir N. Makarov Committed by Vladimir Makarov

c-typeck.c (check_init_type_bitfields): Use nonincremental initialization of…

c-typeck.c (check_init_type_bitfields): Use nonincremental initialization of unions whose first member is a bitfield.

Mon Feb  9 18:57:45 1999  Vladimir N. Makarov  <vmakarov@cygnus.com>
	* c-typeck.c (check_init_type_bitfields): Use nonincremental
	initialization of unions whose first member is a bitfield.
        Remove unnecessary code for checking the declaration mode
        after DECL_C_BIT_FIELD.
	* varasm.c (output_constructor): Additional comment about the
 	constructor of bitfield union initialization.

From-SVN: r25093
parent ef5ae176
Mon Feb 9 18:57:45 1999 Vladimir N. Makarov <vmakarov@cygnus.com>
* c-typeck.c (check_init_type_bitfields): Use nonincremental
initialization of unions whose first member is a bitfield.
Remove unnecessary code for checking the declaration mode
after DECL_C_BIT_FIELD.
* varasm.c (output_constructor): Additional comment about the
constructor of bitfield union initialization.
Tue Feb 9 11:55:04 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/c4x.md (*movhi_stik): New pattern.
......
......@@ -5480,9 +5480,7 @@ check_init_type_bitfields (type)
for (tail = TYPE_FIELDS (type); tail;
tail = TREE_CHAIN (tail))
{
if (DECL_C_BIT_FIELD (tail)
/* This catches cases like `int foo : 8;'. */
|| DECL_MODE (tail) != TYPE_MODE (TREE_TYPE (tail)))
if (DECL_C_BIT_FIELD (tail))
{
constructor_incremental = 0;
break;
......@@ -5492,6 +5490,17 @@ check_init_type_bitfields (type)
}
}
else if (TREE_CODE (type) == UNION_TYPE)
{
tree tail = TYPE_FIELDS (type);
if (tail && DECL_C_BIT_FIELD (tail))
/* We also use the nonincremental algorithm for initiliazation
of unions whose first member is a bitfield, becuase the
incremental algorithm has no code for dealing with
bitfields. */
constructor_incremental = 0;
}
else if (TREE_CODE (type) == ARRAY_TYPE)
check_init_type_bitfields (TREE_TYPE (type));
}
......
......@@ -3998,7 +3998,11 @@ output_constructor (exp, size)
FIELD goes through the structure fields, if the constant is a structure.
if the constant is a union, then we override this,
by getting the field from the TREE_LIST element.
But the constant could also be an array. Then FIELD is zero. */
But the constant could also be an array. Then FIELD is zero.
There is always a maximum of one element in the chain LINK for unions
(even if the initializer in a source program incorrectly contains
more one). */
for (link = CONSTRUCTOR_ELTS (exp);
link;
link = TREE_CHAIN (link),
......
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