From mboxrd@z Thu Jan 1 00:00:00 1970 From: liamq@punkass.com To: gcc-gnats@gcc.gnu.org Subject: c++/3898: broken "do {...} while ()" causes fatal parse error Date: Tue, 31 Jul 2001 09:16:00 -0000 Message-id: <20010731161128.17177.qmail@sourceware.cygnus.com> X-SW-Source: 2001-07/msg00825.html List-Id: >Number: 3898 >Category: c++ >Synopsis: broken "do {...} while ()" causes fatal parse error >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: ice-on-illegal-code >Submitter-Id: net >Arrival-Date: Tue Jul 31 09:16:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Kyle Schaffrick >Release: gcc version 3.0.1 20010626 (prerelease) >Organization: >Environment: >Description: when a do {...} while (cond); construct is used in a C++ program, if the "while (cond);" is accidentally omitted, an unrecoverable parse error occurs. the bug causes a Segmentation Fault on RedHat 7.0-bundled version of GCC, but it still exists as a "confused, bailing out" error in the build used by CodeSourcery's online compiler test (used for this bug report). apparently the compiler does not crash anymore, but compilation stops and the obfusicated error messages sometimes make the error difficult to spot. The compiler output (error messages, warnings, etc): src.cpp: In function `int main()': src.cpp:10: parse error before `return' src.cpp:4: confused by earlier errors, bailing out >How-To-Repeat: program: (src.cpp) int main(void) { int iJunk = 0; do { iJunk++; if (iJunk > 10) return 0; } // accidental exclusion of "while (cond);" // causes fatal parse error return 0; } The system type (the dir name after gcc-lib in the output of gcc -v i386-pc-linux-gnu The complete command line that triggers the bug gcc src.cpp >Fix: >Release-Note: >Audit-Trail: >Unformatted: