]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/56167 (ICE with invalid __attribute__ arguments)
authorJakub Jelinek <jakub@redhat.com>
Tue, 5 Feb 2013 08:08:27 +0000 (09:08 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 5 Feb 2013 08:08:27 +0000 (09:08 +0100)
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
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr56167.c [new file with mode: 0644]

index 2fbc8f49b70bf45b10ac4d820b0daa001bb6fc19..16ef84a36345b41fd0b733e719489f2f9d8af118 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/56167
+       * c-common.c (handle_error_attribute): Fix condition.
+
 2013-01-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/55742
index b3699dc086b40b447b9a35cbbd53215bad5cdde4..1e6afaa77f247f23b908654ca6d8859b122db9d7 100644 (file)
@@ -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.  */
     ;
index acdad16e5ebdf380419a7df546e6c08b62227fda..ab73fbf6b08d329862925e779376f89dd86052c6 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/56167
+       * gcc.dg/pr56167.c: New test.
+
 2013-02-04  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/55146
diff --git a/gcc/testsuite/gcc.dg/pr56167.c b/gcc/testsuite/gcc.dg/pr56167.c
new file mode 100644 (file)
index 0000000..fc377b4
--- /dev/null
@@ -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;
+}