https://bugs.llvm.org/show_bug.cgi?id=46690
Bug ID: 46690
Summary: Dead call to std::terminate when using noexcept
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Hello, it seems that clang does not optimize some dead code paths when
exceptions are involved.
I know this is common, but since at least GCC is able to optimize this case, I
thought it might have been valuable reporting it.
----
int bar_ex_noexcept(int i)
noexcept
{
struct foo{};
try {
if (i <0){
throw foo();
}
return i;
} catch(...) {
return -1;
}
}
----
GCC output https://godbolt.org/z/5E3jbx (note missing terminate even without
optimizations), and clangs output with -O3: https://godbolt.org/z/1ozsGP
I'm not very good at reading assembly, but strangely removing "noexcept", seem
to produce better code.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs