* c-common.c (split_specs_attrs): Allow for empty attributes with
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Sep 2001 12:52:04 +0000 (12:52 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Sep 2001 12:52:04 +0000 (12:52 +0000)
empty TREE_PURPOSE.  Fixes PR c/4294.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45541 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 266154b..306bf2a 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 72b1417..91f4b0a 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 852b1e8..6dc91cd 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();