[LLVMbugs] [Bug 1863] New: parser crash involving isConstantExpr() on incorrect code

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Dec 14 13:30:20 PST 2007


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

           Summary: parser crash involving isConstantExpr() on incorrect
                    code
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kremenek at cs.stanford.edu
                CC: llvmbugs at cs.uiuc.edu


The following (incorrect) code breaks the parser:

int foo();

int test() {}
  typedef int x[foo()];
  int y = sizeof(x);
  int z = sizeof(int[foo()]);
  return y + z;
}


from gdb:

(gdb) r
Starting program: /Volumes/Data/Users/kremenek/llvm/Debug/bin/clang /tmp/t4.c
Reading symbols for shared libraries ++++. done
/tmp/t4.c:4:15: error: variable length array declared outside of any function
  typedef int x[foo()];
              ^ ~~~~~
Assertion failed: (loc.isValid() && "isConstantExpr didn't return a loc!"),
function CheckSingleInitializer, file SemaDecl.cpp, line 362.

Program received signal SIGABRT, Aborted.


Notice the extra "}" on the line "int test() {}".  I'm not certain what the
correct behavior should be in this case, but it certainly shouldn't be a crash.


-- 
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