diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2001-06-22 20:19:03 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2001-06-22 20:19:03 +0100 |
commit | f9e1917eb31a9c2975eabe980cbedfb44571ad6f (patch) | |
tree | 37a3f447efcf42662b23e1928c635f11d08eafcb /gcc | |
parent | 9e2f7ec7e5f627299087530e4a499cd609ee453c (diff) | |
download | gcc-f9e1917eb31a9c2975eabe980cbedfb44571ad6f.zip gcc-f9e1917eb31a9c2975eabe980cbedfb44571ad6f.tar.gz gcc-f9e1917eb31a9c2975eabe980cbedfb44571ad6f.tar.bz2 |
re PR c/3259 (({ }) and -Wall)
* c-common.c (verify_tree): Check for x being NULL.
* doc/c-tree.texi: Document COMPOUND_BODY of an empty
COMPOUND_STMT.
Fixes PR c/3259.
testsuite:
* gcc.dg/20010622-1.c: New test.
From-SVN: r43508
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-common.c | 5 | ||||
-rw-r--r-- | gcc/doc/c-tree.texi | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/20010622-1.c | 11 |
5 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 928491e..3a0fcda 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-06-22 Joseph S. Myers <jsm28@cam.ac.uk> + + * c-common.c (verify_tree): Check for x being NULL. + * doc/c-tree.texi: Document COMPOUND_BODY of an empty + COMPOUND_STMT. + Fixes PR c/3259. + 2001-06-22 DJ Delorie <dj@redhat.com> * config/arm/arm.h (struct machine_function): Remove ra_rtx. diff --git a/gcc/c-common.c b/gcc/c-common.c index 2c079e0..0990f23 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1592,6 +1592,11 @@ verify_tree (x, pbefore_sp, pno_sp, writer) enum tree_code code; char class; + /* X may be NULL if it is the operand of an empty statement expression + ({ }). */ + if (x == NULL) + return; + restart: code = TREE_CODE (x); class = TREE_CODE_CLASS (code); diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi index a67b0ca..370c90f 100644 --- a/gcc/doc/c-tree.texi +++ b/gcc/doc/c-tree.texi @@ -1473,6 +1473,8 @@ should be run in the reverse order of the order in which the associated Used to represent a brace-enclosed block. The first substatement is given by @code{COMPOUND_BODY}. Subsequent substatements are found by following the @code{TREE_CHAIN} link from one substatement to the next. +The @code{COMPOUND_BODY} will be @code{NULL_TREE} if there are no +substatements. @item CONTINUE_STMT diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5befa53..1a5721f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-06-22 Joseph S. Myers <jsm28@cam.ac.uk> + + * gcc.dg/20010622-1.c: New test. + 2001-06-18 Stan Shebs <shebs@apple.com> * objc.dg: New directory. diff --git a/gcc/testsuite/gcc.dg/20010622-1.c b/gcc/testsuite/gcc.dg/20010622-1.c new file mode 100644 index 0000000..dc4b28c --- /dev/null +++ b/gcc/testsuite/gcc.dg/20010622-1.c @@ -0,0 +1,11 @@ +/* Test for segfault doing -Wsequence-point processing on an empty + statement expression. */ +/* Origin: PR c/3259 from <David.Decotigny@irisa.fr>. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +void +f (void) +{ + ({ }); +} |