[llvm-bugs] [Bug 50357] New: Wrong code produced with -O3 when exception specifications are used (wasm32-unknown-emscripten target)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 15 21:54:00 PDT 2021


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

            Bug ID: 50357
           Summary: Wrong code produced with -O3 when exception
                    specifications are used (wasm32-unknown-emscripten
                    target)
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dragonroot at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 24860
  --> https://bugs.llvm.org/attachment.cgi?id=24860&action=edit
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210516/4beaea04/attachment.html>


More information about the llvm-bugs mailing list