[LLVMbugs] [Bug 22672] New: Parser crash on typo-corrected code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 23 20:17:16 PST 2015


            Bug ID: 22672
           Summary: Parser crash on typo-corrected code
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matt.giuca at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13932
  --> http://llvm.org/bugs/attachment.cgi?id=13932&action=edit
Output / crash backtrace

Clang++ crashed while attempting to fix up a typo. I managed to reduce it down
to a minimal reproduction example:

class MyClass {
  void foo();
  int bar();

class Main {
  MyClass* myfield() const;
  void MyMethod();

void Main::MyMethod() {
  int x = myfield_->bar();

It tries to rename myfield_ ("use of undeclared identifier 'myfield_'; did you
mean 'myfield'?") to myfield, and then tries to turn that into a method call
("reference to non-static member function must be called; did you mean to call
it with no arguments?"). Then it crashes in the parser.

The crash seems to require both of the above automatic rewrites, as well as two
calls to myfield_ methods, the latter of which must be assigned to a variable.
If I simplify the example further, the crash goes away.

Note that I am using the version of Clang which is set up by the Chromium
project (I am not sure if it has been modified), but that I have removed all of
the Chromium-specific compiler flags (this example repros when compiled without
any arguments).

clang version 3.6.0 (trunk 223108)
Target: x86_64-unknown-linux-gnu
Thread model: posix

The same code, compiled with "Ubuntu clang version 3.4-1ubuntu3", does not
crash the compiler (it just gives the appropriate parse errors and terminates).

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150224/48e13662/attachment.html>

More information about the llvm-bugs mailing list