]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/35436 (ICE with attribute "format")
authorVolker Reichelt <v.reichelt@netcologne.de>
Thu, 17 Apr 2008 19:40:03 +0000 (19:40 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 17 Apr 2008 19:40:03 +0000 (19:40 +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: r134408

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

index 36e7853b765b8485f483e9e84d5b3d58cce36845..58cb5dd006c0b8167fc05d1c54322cfae378dd98 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-17  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c/35436
+       * c-format.c (init_dynamic_gfc_info): Ignore invalid locus type.
+
 2008-04-08  Richard Guenther  <rguenther@suse.de>
 
        * fold-const.c (fold_widened_comparison): Do not allow
index 4d20d63d1bdf606616b3a142e6a69b4495d60228..cbb224252564c37e15099a95a38bee835916992c 100644 (file)
@@ -2437,7 +2437,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 ad991a5b532d3d86430d755725a591de95eb7548..fa8b6ed67839ef959575dba1ad428ff00df94ae4 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-17  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c/35436
+       * gcc.dg/format/gcc_gfc-2.c: New test.
+
 2008-04-08  Richard Guenther  <rguenther@suse.de>
 
        * gcc.c-torture/execute/20080408-1.c: New testcase.
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" }  */
+}