re PR c/22240 (ICE with transparent unions, function pointers and -pedantic)
authorJoseph Myers <joseph@codesourcery.com>
Fri, 29 Jul 2005 02:46:50 +0000 (03:46 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Fri, 29 Jul 2005 02:46:50 +0000 (03:46 +0100)
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
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/transparent-union-4.c [new file with mode: 0644]

index 0617b8f11379ab615c325543cc0f5ad8299b8bca..86664bab127cbae3c5bc5526964f3ff07d618fb7 100644 (file)
@@ -1,3 +1,9 @@
+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
index 58694cb5ceba048cb23af08f464d71da75b4a5a1..eb7909ed7690f9fab7b7c5182c18530bfe696734 100644 (file)
@@ -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);
index 4da38559704b9a205b2f1bef2a47e49b28fc52ef..acb1606f3739731418bea315a599319cb24c28fb 100644 (file)
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/gcc.dg/transparent-union-4.c b/gcc/testsuite/gcc.dg/transparent-union-4.c
new file mode 100644 (file)
index 0000000..f661cf2
--- /dev/null
@@ -0,0 +1,9 @@
+/* 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" } */