<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 - Missing a recursion guard for sizeof"
   href="https://bugs.llvm.org/show_bug.cgi?id=45716">45716</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing a recursion guard for sizeof
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jynelson@email.sc.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=23412" name="attach_23412" title="The output of the shell command mentioned in the bug report">attachment 23412</a> <a href="attachment.cgi?id=23412&action=edit" title="The output of the shell command mentioned in the bug report">[details]</a></span>
The output of the shell command mentioned in the bug report

The following command crashes clang:

```
$ { echo 'int i = '; yes 'sizeof ' | head -n 2000; echo 'int;'; } | tr -d '\n'
| clang -x c -
```

I expect this to instead give an error about the expression being too nested,
like clang does for parentheses:

```
$ { echo 'int i = '; yes '( ' | head -n 2000;  } | tr -d '\n' | clang -x c -
<stdin>:1:521: fatal error: bracket nesting level exceeded maximum of 256
```

Extract of the stack trace (it goes on for another 300 stack frames):

#330 0x00007f7dcd91080f ParseCastExpression
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:535:20
#331 0x00007f7dcd91080f
clang::Parser::ParseExprAfterUnaryExprOrTypeTrait(clang::Token const&, bool&,
clang::OpaquePtr<clang::QualType>&, clang::SourceRange&)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:1924:15
#332 0x00007f7dcd90f3c8 clang::Parser::ParseUnaryExprOrTypeTraitExpression()
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:2037:24
#333 0x00007f7dcd905999 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:1204:12
#334 0x00007f7dcd91080f ParseCastExpression
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:535:20
#335 0x00007f7dcd91080f
clang::Parser::ParseExprAfterUnaryExprOrTypeTrait(clang::Token const&, bool&,
clang::OpaquePtr<clang::QualType>&, clang::SourceRange&)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:1924:15
#336 0x00007f7dcd90f3c8 clang::Parser::ParseUnaryExprOrTypeTraitExpression()
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:2037:24
#337 0x00007f7dcd905999 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:1204:12
#338 0x00007f7dcd91080f ParseCastExpression
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:535:20
#339 0x00007f7dcd91080f
clang::Parser::ParseExprAfterUnaryExprOrTypeTrait(clang::Token const&, bool&,
clang::OpaquePtr<clang::QualType>&, clang::SourceRange&)
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:1924:15
#340 0x00007f7dcd90f3c8 clang::Parser::ParseUnaryExprOrTypeTraitExpression()
/build/llvm-toolchain-9-uSl4bC/llvm-toolchain-9-9/tools/clang/lib/Parse/ParseExpr.cpp:2037:24
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0-2~ubuntu18.04.2 (tags/RELEASE_900/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /home/joshua/.local/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg: Error generating preprocessed source(s) - ignoring
input from stdin.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.</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>