Commit e616f54d by Joseph Myers Committed by Joseph Myers

re PR c/42708 (ICE in gimplify_expr, at gimplify.c:6993)

	PR c/42708
	* c-typeck.c (build_c_cast): Fold value cast to union type before
	wrapping it in a CONSTRUCTOR.

testsuite:
	* gcc.c-torture/compile/pr42708-1.c: New test.

From-SVN: r155846
parent b4ab701f
2010-01-12 Joseph Myers <joseph@codesourcery.com>
PR c/42708
* c-typeck.c (build_c_cast): Fold value cast to union type before
wrapping it in a CONSTRUCTOR.
2010-01-12 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/42699
......
......@@ -4429,10 +4429,14 @@ build_c_cast (location_t loc, tree type, tree expr)
if (field)
{
tree t;
bool maybe_const = true;
pedwarn (loc, OPT_pedantic, "ISO C forbids casts to union type");
t = digest_init (loc, type,
build_constructor_single (type, field, value),
t = c_fully_fold (value, false, &maybe_const);
t = build_constructor_single (type, field, t);
if (!maybe_const)
t = c_wrap_maybe_const (t, true);
t = digest_init (loc, type, t,
NULL_TREE, false, true, 0);
TREE_CONSTANT (t) = TREE_CONSTANT (value);
return t;
......
2010-01-12 Joseph Myers <joseph@codesourcery.com>
PR c/42708
* gcc.c-torture/compile/pr42708-1.c: New test.
2010-01-12 Jakub Jelinek <jakub@redhat.com>
PR debug/42662
......
typedef __SIZE_TYPE__ size_t;
void *malloc(size_t);
typedef union YYSTYPE {
char *id;
} YYSTYPE;
extern YYSTYPE yylval;
void yylex (int b)
{
yylval = (YYSTYPE) (b ? 0 : (char *) malloc (4));
}
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