<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 - Clang hangs with "too many errors emitted""
   href="https://bugs.llvm.org/show_bug.cgi?id=40762">40762</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang hangs with "too many errors emitted"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>theirix@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=21488" name="attach_21488" title="example">attachment 21488</a> <a href="attachment.cgi?id=21488&action=edit" title="example">[details]</a></span>
example

*Overview*

Clang hangs infinitely on a specific source code just after printing
diagnostics line:

fatal error: too many errors emitted, stopping now [-ferror-limit=]

The reproducing example unfortunately depends on boost::test. I think a bug is
actually caused by heaviness of boost::test. I checked the error with Boost
1.68 and Boost 1.62 from Debian.


*Steps to Reproduce*

1. Install boost headers - 1.68 works fine, 1.62 on Debian works too
(libboost-dev)

2. Compile attached file:

clang++ --std=c++11 -O0 -c main.cxx


*Actual Results*

1. Compiler gives an error and hangs (at least 30 minutes)


*Expected Results*

1. Should give error and exit with error code 


*Build Date & Hardware*

- Reproduced on Linux with 7.0.1 and 3.8.
- Reproduced on macOS with LLVM-provided clang 7.0.0 and apple-clang 10.0.0.
- GCC works fine.

Stacktrace when SIGINT-ed:

```
fatal error: too many errors emitted, stopping now [-ferror-limit=]
^C
Program received signal SIGINT, Interrupt.
0x00007ffff7bccb0a in __waitpid (pid=32641, stat_loc=0x7fffffffca14, options=0)
at ../sysdeps/unix/sysv/linux/waitpid.c:29
29      ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7bccb0a in __waitpid (pid=32641, stat_loc=0x7fffffffca14,
options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x0000000001cea90f in llvm::sys::Wait(llvm::sys::ProcessInfo const&,
unsigned int, bool, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*) ()
#2  0x0000000001ce9837 in llvm::sys::ExecuteAndWait(llvm::StringRef,
llvm::ArrayRef<llvm::StringRef>, llvm::Optional<llvm::ArrayRef<llvm::StringRef>
<span class="quote">>, llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, unsigned int, unsigned</span >
int, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) ()
#3  0x000000000216bc22 in
clang::driver::Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const ()
#4  0x0000000002141ab5 in
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const ()
#5  0x0000000002141d8a in
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
()
#6  0x000000000215782b in
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) ()
#7  0x00000000009326ef in main ()
(gdb)%
```</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>