https://bugs.llvm.org/show_bug.cgi?id=44997

            Bug ID: 44997
           Summary: Parser crashes with invalid syntax
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: nicolas.alva...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

Created attachment 23163
  --> https://bugs.llvm.org/attachment.cgi?id=23163&action=edit
Stack dump of crash

While reducing a test case with creduce, I ended up with a totally unrelated
crash than what I was looking for.

The following 9 tokens of invalid code abort the clang parser by executing an
llvm_unreachable statement:


class {
   a(struct b
  struct b   ;


The newlines are apparently significant. Since it's an llvm_unreachable, you
need asserts enabled to reproduce.

Output:

$ clang++ -fsyntax-only viewmodeE.cpp
viewmodeE.cpp:2:14: error: expected ';' after struct
   a(struct b
             ^
             ;                                                                  
viewmodeE.cpp:3:3: error: expected ')'
  struct b   ;
  ^
viewmodeE.cpp:2:5: note: to match this '('
   a(struct b
    ^
viewmodeE.cpp:2:4: error: C++ requires a type specifier for all declarations
   a(struct b
   ^
viewmodeE.cpp:3:10: error: 'b' redeclared with 'private' access
  struct b   ;
         ^
Invalid access specifier!
UNREACHABLE executed at ../llvm/tools/clang/lib/AST/DeclCXX.cpp:3165!


I bisected the crash back to this commit from 2016(!):
https://github.com/llvm/llvm-project/commit/078aea904331271c3fdc65b52d128a8acefe4e38

Full stack trace attached.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to