From cf35e2b1e6e24e73f727deda55d6f4042a8ef23d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 5 Feb 2013 09:08:27 +0100 Subject: re PR middle-end/56167 (ICE with invalid __attribute__ arguments) PR middle-end/56167 * c-common.c (handle_error_attribute): Fix condition. * gcc.dg/pr56167.c: New test. From-SVN: r195748 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-common.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr56167.c | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr56167.c (limited to 'gcc') diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2fbc8f4..16ef84a 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2013-02-05 Jakub Jelinek + + PR middle-end/56167 + * c-common.c (handle_error_attribute): Fix condition. + 2013-01-30 Jakub Jelinek PR c++/55742 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index b3699dc..1e6afaa 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6678,7 +6678,7 @@ handle_error_attribute (tree *node, tree name, tree args, int ARG_UNUSED (flags), bool *no_add_attrs) { if (TREE_CODE (*node) == FUNCTION_DECL - || TREE_CODE (TREE_VALUE (args)) == STRING_CST) + && TREE_CODE (TREE_VALUE (args)) == STRING_CST) /* Do nothing else, just set the attribute. We'll get at it later with lookup_attribute. */ ; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index acdad16..ab73fbf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-05 Jakub Jelinek + + PR middle-end/56167 + * gcc.dg/pr56167.c: New test. + 2013-02-04 Oleg Endo PR target/55146 diff --git a/gcc/testsuite/gcc.dg/pr56167.c b/gcc/testsuite/gcc.dg/pr56167.c new file mode 100644 index 0000000..fc377b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56167.c @@ -0,0 +1,15 @@ +/* PR middle-end/56167 */ +/* { dg-do compile } */ + +extern void foo (void) __attribute__ ((error (0))); /* { dg-warning "attribute ignored" } */ +extern void bar (void) __attribute__ ((warning (0))); /* { dg-warning "attribute ignored" } */ +int var __attribute__ ((error ("foo"))); /* { dg-warning "attribute ignored" } */ + +int +main () +{ + foo (); + bar (); + var++; + return 0; +} -- cgit v1.1