#include <iostream>
void c() {
throw std::runtime_error("e");
}
void f() {
try {
c();
} catch (...) {
std::cerr << "caught\n";
}
}
int main() {
f();
return 0;
}
This could cause a segfault or an infinite loop when compiled with --crel:
# clang++ -fuse-ld=lld -Wa,--crel,--allow-experimental-crel 0.cc
# ./a.out
<does not exit>
a brasl seems to be branching into itself:
0x1001d04 <main+20> brasl %r14,0x1001d04 <main+20>
Version details:
# clang++ -v
clang version 19.1.7 ( 19.1.7-2.module+el8.10.0+23045+e1f8e80e)
Target: s390x-redhat-linux-gnu
Seems to be similar to this issue on arm: #141678