<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Parser crashes with invalid syntax"
   href="https://bugs.llvm.org/show_bug.cgi?id=44997">44997</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Parser crashes with invalid syntax
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolas.alvarez@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23163" name="attach_23163" title="Stack dump of crash">attachment 23163</a> <a href="attachment.cgi?id=23163&action=edit" title="Stack dump of crash">[details]</a></span>
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(!):
<a href="https://github.com/llvm/llvm-project/commit/078aea904331271c3fdc65b52d128a8acefe4e38">https://github.com/llvm/llvm-project/commit/078aea904331271c3fdc65b52d128a8acefe4e38</a>

Full stack trace attached.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>