summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-16 20:13:07 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-16 20:13:07 +0000
commit045f0656692c557b58aa639fef96adc70ae1180d (patch)
tree28595a498cea666dc9365125cb358fc6b2ed65e7
parent1cbd4e96fc496437c7d4eb0833ab151ce6d9e2bf (diff)
downloadppe42-gcc-045f0656692c557b58aa639fef96adc70ae1180d.tar.gz
ppe42-gcc-045f0656692c557b58aa639fef96adc70ae1180d.zip
.:
PR c++/7640 * c-semantics.c (genrtl_do_stmt): Cope with NULL cond. testsuite: * g++.dg/other/do1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57212 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-semantics.c5
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/other/do1.C12
4 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aafdefb730a..7aaf2c76cf2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * c-semantics.c (genrtl_do_stmt): Cope with NULL cond.
+
2002-09-16 Geoffrey Keating <geoffk@redhat.com>
* config/rs6000/rs6000.c (build_mask64_2_operands): Suppress
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 35cb559e6f8..a4d11f8e606 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -447,8 +447,9 @@ genrtl_do_stmt (t)
/* Recognize the common special-case of do { ... } while (0) and do
not emit the loop widgetry in this case. In particular this
avoids cluttering the rtl with dummy loop notes, which can affect
- alignment of adjacent labels. */
- if (integer_zerop (cond))
+ alignment of adjacent labels. COND can be NULL due to parse
+ errors. */
+ if (!cond || integer_zerop (cond))
{
expand_start_null_loop ();
expand_stmt (DO_BODY (t));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 63b882ffbae..b2e49b01abc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
+ * g++.dg/other/do1.C: New test.
+
* g++.dg/template/subst1.C: New test.
2002-09-16 Steve Ellcey <sje@cup.hp.com>
diff --git a/gcc/testsuite/g++.dg/other/do1.C b/gcc/testsuite/g++.dg/other/do1.C
new file mode 100644
index 00000000000..79e55c0cd51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/do1.C
@@ -0,0 +1,12 @@
+// { dg-do compile }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 16 Sep 2002 <nathan@codesourcery.com>
+
+// PR 7640. ICE.
+
+void init ()
+{
+ do { } while (0)
+ obj = 0;
+}
OpenPOWER on IntegriCloud