[LLVMbugs] [Bug 7427] New: Assertion (ParenCount > 0), function MatchRHSPunctuation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 20 10:58:24 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7427

           Summary: Assertion (ParenCount > 0), function
                    MatchRHSPunctuation
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


While reducing a testcase for some other problem that I recently
encountered, and which made clang crash, I found the testcase had been
reduced to just these three lines:

  static void printf_command (char *arg, int from_tty)
  {
    for (i = 0; i++) {

Running this fragment through llvm/clang r106404, using "-cc1 -S" gives:

  parencount.c:3:8: error: use of undeclared identifier 'i'
    for (i = 0; i++) {
     ^
  parencount.c:3:15: error: use of undeclared identifier 'i'
    for (i = 0; i++) {
        ^
  parencount.c:3:21: error: expected expression
    for (i = 0; i++) {
              ^
  parencount.c:3:21: error: expected ')'
  parencount.c:3:7: note: to match this '('
    for (i = 0; i++) {
    ^
  Assertion failed: (ParenCount > 0), function MatchRHSPunctuation, file
  /home/dim/src/llvm/tools/clang/lib/Parse/Parser.cpp, line 135.
  Stack dump:
  0.      Program arguments: /home/dim/llvm/106404-gcc-rel-1/bin/clang
         -cc1 -S parencount.c
  1.      <eof> parser at end of file
  2.      parencount.c:2:1: parsing function body 'printf_command'
  3.      parencount.c:2:1: in compound statement ('{}')
  Abort trap: 6 (core dumped)

For reference, the (by now pretty old) clang r104832 in FreeBSD's base
system does NOT assert, but just produces the expected output:

  parencount.c:3:8: error: use of undeclared identifier 'i'
    for (i = 0; i++) {
     ^
  parencount.c:3:15: error: use of undeclared identifier 'i'
    for (i = 0; i++) {
        ^
  parencount.c:3:21: error: expected expression
    for (i = 0; i++) {
              ^
  parencount.c:3:21: error: expected ')'
  parencount.c:3:7: note: to match this '('
    for (i = 0; i++) {
    ^
  parencount.c:3:21: error: expected expression
    for (i = 0; i++) {
              ^
  parencount.c:3:21: error: expected '}'
  6 errors generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list