c++/3898: broken "do {...} while ()" causes fatal parse error
liamq@punkass.com
liamq@punkass.com
Tue Jul 31 09:16:00 GMT 2001
>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:
More information about the Gcc-prs
mailing list