aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-07-29 03:46:50 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2005-07-29 03:46:50 +0100
commit13b22d3a861a9d82fe3b70e5cb11ca5c2a9d4c98 (patch)
treec843164bfc516d350898eb7912dcbbe95a18ab88 /gcc
parentca8bdb78eabbe748e23754fcf2fd8e4bf308f2c4 (diff)
downloadgcc-13b22d3a861a9d82fe3b70e5cb11ca5c2a9d4c98.zip
gcc-13b22d3a861a9d82fe3b70e5cb11ca5c2a9d4c98.tar.gz
gcc-13b22d3a861a9d82fe3b70e5cb11ca5c2a9d4c98.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/transparent-union-4.c9
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0617b8f..86664ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
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.
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 58694cb..eb7909e 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 4da3855..acb1606 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
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.
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 0000000..f661cf2
--- /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 <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" } */