Fix ICE for bit-fields with typedef

Fixes #1267

Avoid ICE, but treat plain int bit-fields declared via typedef as
signed rather than unsigned.  It is more efficient to treat them
as unsigned, but this requires distinguishing int from signed int,
and this is curently not done.
This commit is contained in:
Jesse Rosenstock
2020-09-26 14:56:28 +02:00
committed by Oliver Schmidt
parent 4acdc9ced9
commit b931e65811
4 changed files with 88 additions and 6 deletions

View File

@@ -1468,6 +1468,15 @@ static void ParseTypeSpec (DeclSpec* D, long Default, TypeCode Qualifiers,
/* It's a typedef */
NextToken ();
TypeCopy (D->Type, Entry->Type);
/* If it's a typedef, we should actually use whether the signedness was
** specified on the typedef, but that information has been lost. Treat the
** signedness as being specified to work around the ICE in #1267.
** Unforunately, this will cause plain int bit-fields defined via typedefs
** to be treated as signed rather than unsigned.
*/
if (SignednessSpecified) {
*SignednessSpecified = 1;
}
break;
}
} else {