This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C/C++ PATCH]: Fix 7640
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Sep 2002 21:13:16 +0100
- Subject: [C/C++ PATCH]: Fix 7640
- Organization: Codesourcery LLC
Hi,
another obvious patch. The bug report is for C++, but both C and C++
frontends suffer the same problem.
tested on i686-pc-linux-gnu.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2002-09-16 Nathan Sidwell <nathan@codesourcery.com>
PR c++/7640
* c-semantics.c (genrtl_do_stmt): Cope with NULL cond.
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.45
diff -c -3 -p -r1.45 c-semantics.c
*** c-semantics.c 22 Aug 2002 23:22:51 -0000 1.45
--- c-semantics.c 16 Sep 2002 19:46:06 -0000
*************** genrtl_do_stmt (t)
*** 447,454 ****
/* 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))
{
expand_start_null_loop ();
expand_stmt (DO_BODY (t));
--- 447,455 ----
/* 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. COND can be NULL due to parse
! errors. */
! if (!cond || integer_zerop (cond))
{
expand_start_null_loop ();
expand_stmt (DO_BODY (t));
// { 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;
}