<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 - Wrong code produced with -O3 when exception specifications are used (wasm32-unknown-emscripten target)"
href="https://bugs.llvm.org/show_bug.cgi?id=50357">50357</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong code produced with -O3 when exception specifications are used (wasm32-unknown-emscripten target)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dragonroot@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24860" name="attach_24860" title="Source file to reproduce the problem">attachment 24860</a> <a href="attachment.cgi?id=24860&action=edit" title="Source file to reproduce the problem">[details]</a></span>
Source file to reproduce the problem
Compiling the short attached file with -O3 results in invoking a different
catch clause:
$ emcc -fexceptions eh-spec-bug.cc && node a.out.js
Expected result
$ emcc -fexceptions eh-spec-bug.cc -O3 && node a.out.js
UNEXPECTED RESULT
The culprit seems to be the presence of an exception specification. While those
are no longer present in newer editions of the C++ standard, they are still
part of C++98 and C++11, and a lot of code bases still use them.
$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12
Debian clang version 12.0.0-3
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/lib/llvm-12/bin</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>