[llvm-bugs] [Bug 46363] New: WebAssembly hangs on switch with __builtin_unreachable in default.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jun 17 06:31:39 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46363
Bug ID: 46363
Summary: WebAssembly hangs on switch with __builtin_unreachable
in default.
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: bungeman at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
With
$ emsdk/upstream/bin/clang-11 --version
clang version 11.0.0
(/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project
613c4a87ba9bb39d1927402f4dd4c1ef1f9a02f7)
$cat > repro.cpp <<EOF
int CToI(char c) {
switch (c) {
case 'r': return 0;
case 'g': return 1;
case 'b': return 2;
case 'a': return 3;
case '0': return 4;
case '1': return 5;
default:
__builtin_unreachable();
}
}
EOF
$ emsdk/upstream/bin/clang-11 -cc1 -triple wasm32-unknown-emscripten -emit-obj
-disable-free -main-file-name repro.cpp -mrelocation-model static
-mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu
generic -fvisibility hidden -dwarf-column-info -debugger-tuning=gdb -O3
-std=c++17 -nostdsysteminc -mllvm -combiner-global-alias-analysis=false -mllvm
-enable-emscripten-sjlj -mllvm -disable-lsr -o repro.o -x c++ repro.cpp
the clang-11 invocation will hang at any optimization level other than -O0.
This can also currently be reproduced on CompilerExplorer with the above code
with the "WebAssembly clang (trunk)" compiler and any optimization level over
-O0.
This seems to be a fairly recent regression as this was known to work at some
point in the not too distant past (will attempt to bisect). Removing any of the
'case' statements seems to make it work, this seems to require at least six
cases to reproduce.
--
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/20200617/06d9555c/attachment.html>
More information about the llvm-bugs
mailing list