aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@gcc.gnu.org>2008-04-01 20:33:37 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2008-04-01 20:33:37 +0000
commitdc197ab91c79219326ebc83e7353ac4f925e78e5 (patch)
tree132c9feffc06431a45597cb1317e19073a9c2b8d /gcc
parent9e9b53411e671de84ff27b5ff6062bf80d0bea56 (diff)
downloadgcc-dc197ab91c79219326ebc83e7353ac4f925e78e5.zip
gcc-dc197ab91c79219326ebc83e7353ac4f925e78e5.tar.gz
gcc-dc197ab91c79219326ebc83e7353ac4f925e78e5.tar.bz2
re PR c/35436 (ICE with attribute "format")
PR c/35436 * c-format.c (init_dynamic_gfc_info): Ignore invalid locus type. * gcc.dg/format/gcc_gfc-2.c: New test. From-SVN: r133800
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-format.c3
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_gfc-2.c13
4 files changed, 26 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f5c69d5..651dd2a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-01 Volker Reichelt <v.reichelt@netcologne.de>
+
+ PR c/35436
+ * c-format.c (init_dynamic_gfc_info): Ignore invalid locus type.
+
2008-04-02 Ben Elliston <bje@au.ibm.com>
* config/v850/v850.md (casesi): Remove if (0) code.
diff --git a/gcc/c-format.c b/gcc/c-format.c
index 13de910..d1a136f 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -2474,7 +2474,8 @@ init_dynamic_gfc_info (void)
locus = identifier_global_value (locus);
if (locus)
{
- if (TREE_CODE (locus) != TYPE_DECL)
+ if (TREE_CODE (locus) != TYPE_DECL
+ || TREE_TYPE (locus) == error_mark_node)
{
error ("%<locus%> is not defined as a type");
locus = 0;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8e9f51b..5808d5c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,11 @@
+2008-04-01 Volker Reichelt <v.reichelt@netcologne.de>
+
+ PR c/35436
+ * gcc.dg/format/gcc_gfc-2.c: New test.
+
2008-03-31 Seongbae Park <seongbae.park@gmail.com>
- * g++.db/bprob/bprob.exp: Do not check gcno files.
+ * g++.dg/bprob/bprob.exp: Do not check gcno files.
Use -fprofile-use for profile use.
* gcc.misc-tests/bprob.exp: Ditto.
* g++.dg/tree-pro/tree-prof.exp: Do not check gcno files.
diff --git a/gcc/testsuite/gcc.dg/format/gcc_gfc-2.c b/gcc/testsuite/gcc.dg/format/gcc_gfc-2.c
new file mode 100644
index 0000000..f3095fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/gcc_gfc-2.c
@@ -0,0 +1,13 @@
+/* PR c/35436 */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+typedef void locus[1]; /* { dg-error "array of void" } */
+
+void foo(const char*, ...)
+ __attribute__((__format__(__gcc_gfc__, 1, 2))); /* { dg-error "locus" } */
+
+void bar()
+{
+ foo("%L", 0); /* { dg-warning "format" } */
+}