From 13b22d3a861a9d82fe3b70e5cb11ca5c2a9d4c98 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 29 Jul 2005 03:46:50 +0100 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/c-typeck.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/transparent-union-4.c | 9 +++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/transparent-union-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0617b8f11379..86664bab127c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-07-29 Joseph S. Myers + + 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 PR c/22192 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 58694cb5ceba..eb7909ed7690 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4da38559704b..acb1606f3739 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-07-29 Joseph S. Myers + + PR c/22240 + * gcc.dg/transparent-union-4.c: New test. + 2005-07-29 Joseph S. Myers PR c/22192 diff --git a/gcc/testsuite/gcc.dg/transparent-union-4.c b/gcc/testsuite/gcc.dg/transparent-union-4.c new file mode 100644 index 000000000000..f661cf2cb54d --- /dev/null +++ b/gcc/testsuite/gcc.dg/transparent-union-4.c @@ -0,0 +1,9 @@ +/* Test for ICE on transparent union with function pointer and + -pedantic. Bug 22240. */ +/* Origin: Joseph Myers */ +/* { 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" } */ -- 2.43.5