re PR c/35436 (ICE with attribute "format")
authorVolker Reichelt <reichelt@gcc.gnu.org>
Tue, 1 Apr 2008 20:33:37 +0000 (20:33 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Tue, 1 Apr 2008 20:33:37 +0000 (20:33 +0000)
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

gcc/ChangeLog
gcc/c-format.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/gcc_gfc-2.c [new file with mode: 0644]

index f5c69d5c07a6015a4d7661f290f3be7948d8f42a..651dd2a3a51ad1801e56a43381f5bc5463356dff 100644 (file)
@@ -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.
index 13de9106f3a8a509481cf3acb4a435468b7fa435..d1a136f87ec5fc211e8403ca1991ee94bafda486 100644 (file)
@@ -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;
index 8e9f51b84eb1f4abc389b301022c480cfb918dbc..5808d5cb4e2b72342a10f057e0e9da747bc34d26 100644 (file)
@@ -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 (file)
index 0000000..f3095fa
--- /dev/null
@@ -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" }  */
+}