OSDN Git Service

* c-common.c (verify_tree): Check for x being NULL.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 Jun 2001 19:19:03 +0000 (19:19 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 Jun 2001 19:19:03 +0000 (19:19 +0000)
* doc/c-tree.texi: Document COMPOUND_BODY of an empty
COMPOUND_STMT.
Fixes PR c/3259.

testsuite:
* gcc.dg/20010622-1.c: New test.

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

gcc/ChangeLog
gcc/c-common.c
gcc/doc/c-tree.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20010622-1.c [new file with mode: 0644]

index 928491e..3a0fcda 100644 (file)
@@ -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.
index 2c079e0..0990f23 100644 (file)
@@ -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);
index a67b0ca..370c90f 100644 (file)
@@ -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
 
index 5befa53..1a5721f 100644 (file)
@@ -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 (file)
index 0000000..dc4b28c
--- /dev/null
@@ -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)
+{
+  ({ });
+}