Commit 13b22d3a by Joseph Myers Committed by Joseph Myers

re PR c/22240 (ICE with transparent unions, function pointers and -pedantic)

	PR c/22240
	* c-typeck.c (convert_for_assignment): Do not check
	DECL_IN_SYSTEM_HEADER on NULL fundecl.

testsuite:
	* gcc.dg/transparent-union-4.c: New test.

From-SVN: r102541
parent ca8bdb78
2005-07-29 Joseph S. Myers <joseph@codesourcery.com>
PR c/22240
* c-typeck.c (convert_for_assignment): Do not check
DECL_IN_SYSTEM_HEADER on NULL fundecl.
2005-07-29 Joseph S. Myers <joseph@codesourcery.com>
PR c/22192
* c-typeck.c (composite_type): Prefer constant size arrays to
VLAs.
......
......@@ -3782,7 +3782,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
"pointer target type"));
}
if (pedantic && !DECL_IN_SYSTEM_HEADER (fundecl))
if (pedantic && (!fundecl || !DECL_IN_SYSTEM_HEADER (fundecl)))
pedwarn ("ISO C prohibits argument conversion to union type");
return build1 (NOP_EXPR, type, rhs);
......
2005-07-29 Joseph S. Myers <joseph@codesourcery.com>
PR c/22240
* gcc.dg/transparent-union-4.c: New test.
2005-07-29 Joseph S. Myers <joseph@codesourcery.com>
PR c/22192
* gcc.dg/c99-vla-2.c: New test.
......
/* Test for ICE on transparent union with function pointer and
-pedantic. Bug 22240. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-options "-pedantic" } */
typedef union { union w *u; int *i; } H __attribute__ ((transparent_union));
void (*h) (H);
void g (int *s) { h (s); } /* { dg-warning "ISO C prohibits argument conversion to union type" } */
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