re PR c/4294 (ICE for bad empty attribute)
authorJoseph Myers <jsm28@cam.ac.uk>
Tue, 11 Sep 2001 12:52:04 +0000 (13:52 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Tue, 11 Sep 2001 12:52:04 +0000 (13:52 +0100)
* c-common.c (split_specs_attrs): Allow for empty attributes with
empty TREE_PURPOSE.  Fixes PR c/4294.

testsuite:
* gcc.c-torture/compile/20010911-1.c: New test.

From-SVN: r45541

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20010911-1.c [new file with mode: 0644]

index 266154bcdc7e2b021fe6c58a5a07d416dfebbbbb..306bf2a34b937c9577f3ae96edabf3c9b74e110e 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-11  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * c-common.c (split_specs_attrs): Allow for empty attributes with
+       empty TREE_PURPOSE.  Fixes PR c/4294.
+
 Tue Sep 11 11:37:52 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
        * basic-block.h (cached_make_edge, make_single_succ): New.
index 72b1417f8d438f199cb35553b32a49da2937a127..91f4b0acaf7811f4f65ab369b7b822feb79f65e4 100644 (file)
@@ -1204,7 +1204,9 @@ split_specs_attrs (specs_attrs, declspecs, prefix_attributes)
              s = t;
            }
        }
-      else
+      /* The TREE_PURPOSE may also be empty in the case of
+        __attribute__(()).  */
+      else if (TREE_PURPOSE (t) != NULL_TREE)
        {
          if (attrs == NULL_TREE)
            attrs = a = TREE_PURPOSE (t);
index 852b1e820cc143a1c9336a30172a4caa7a77d1e2..6dc91cd45704dc04019becf4874ca46c0109a29b 100644 (file)
@@ -1,3 +1,7 @@
+2001-09-11  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * gcc.c-torture/compile/20010911-1.c: New test.
+
 2001-09-10  Janis Johnson  <janis187@us.ibm.com>
 
        * lib/profopt.exp: New, to support profile-directed optimizations.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010911-1.c b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c
new file mode 100644 (file)
index 0000000..f5a4724
--- /dev/null
@@ -0,0 +1,4 @@
+/* Test for segfault handling an empty attribute.  */
+/* Origin: PR c/4294 from <tori@ringstrom.mine.nu>.  */
+
+void __attribute__(()) foo();