re PR c++/7640 (g++ 3.3 ICE: SEGV in integer_zerop)
authorNathan Sidwell <nathan@codesourcery.com>
Mon, 16 Sep 2002 20:13:07 +0000 (20:13 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 16 Sep 2002 20:13:07 +0000 (20:13 +0000)
.: PR c++/7640
* c-semantics.c (genrtl_do_stmt): Cope with NULL cond.
testsuite:
* g++.dg/other/do1.C: New test.

From-SVN: r57212

gcc/ChangeLog
gcc/c-semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/do1.C [new file with mode: 0644]

index aafdefb730a0c7ba5035db68fb5fdf2b6c18d982..7aaf2c76cf263a19a3608a9c1488b8c196849022 100644 (file)
@@ -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
index 35cb559e6f805348eb7b1e767b685e83e89a8f6f..a4d11f8e6062a8361bed5865f34b0d63620a2094 100644 (file)
@@ -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));
index 63b882ffbaea7b8fee0e79cb692b1ade8724459f..b2e49b01abc7940c56397f11d979d19c33bf8ddd 100644 (file)
@@ -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 (file)
index 0000000..79e55c0
--- /dev/null
@@ -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;
+}