From: Volker Reichelt Date: Thu, 17 Apr 2008 19:40:03 +0000 (+0000) Subject: re PR c/35436 (ICE with attribute "format") X-Git-Tag: prereleases/gcc-4.2.4-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3f1dc19a811e228d1094247e7b686578a2904f6;p=thirdparty%2Fgcc.git 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: r134408 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36e7853b765b..58cb5dd006c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-04-17 Volker Reichelt + + PR c/35436 + * c-format.c (init_dynamic_gfc_info): Ignore invalid locus type. + 2008-04-08 Richard Guenther * fold-const.c (fold_widened_comparison): Do not allow diff --git a/gcc/c-format.c b/gcc/c-format.c index 4d20d63d1bdf..cbb224252564 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -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 ("% is not defined as a type"); locus = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad991a5b532d..fa8b6ed67839 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-17 Volker Reichelt + + PR c/35436 + * gcc.dg/format/gcc_gfc-2.c: New test. + 2008-04-08 Richard Guenther * 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 index 000000000000..f3095fa296f9 --- /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" } */ +}