From 1d30139d37ad8281957c875475c6a496b37ab015 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 11 Sep 2001 13:52:04 +0100 Subject: [PATCH] re PR c/4294 (ICE for bad empty attribute) * 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 | 5 +++++ gcc/c-common.c | 4 +++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/20010911-1.c | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20010911-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 266154bcdc7..306bf2a34b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-09-11 Joseph S. Myers + + * 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 * basic-block.h (cached_make_edge, make_single_succ): New. diff --git a/gcc/c-common.c b/gcc/c-common.c index 72b1417f8d4..91f4b0acaf7 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 852b1e820cc..6dc91cd4570 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-09-11 Joseph S. Myers + + * gcc.c-torture/compile/20010911-1.c: New test. + 2001-09-10 Janis Johnson * 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 index 00000000000..f5a4724bc72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010911-1.c @@ -0,0 +1,4 @@ +/* Test for segfault handling an empty attribute. */ +/* Origin: PR c/4294 from . */ + +void __attribute__(()) foo(); -- 2.30.2