Closed
Description
After a seemingly innocuous change in a filesystem driver in the Linux kernel, there is an assertion failure in the Hexagon constant-extender optimization
pass. cvise
spits out for a reproducer:
enum { BCH_RECOVERY_PASS_scan_for_btree_nodes } six_lock_ip_waiter(long);
void trace_btree_path_lock(long);
static int __btree_node_lock_nopath(long ip) {
int ret = six_lock_ip_waiter(ip);
trace_btree_path_lock(({
__here:
(long) && __here;
}));
return ret;
}
void btree_node_lock_nopath_nofail() {
int ret = __btree_node_lock_nopath(({
__here:
(long) && __here;
}));
ret;
}
which can be crashed when using -fno-PIE
(which the Linux kernel uses):
$ clang --target=hexagon-linux -O2 -c -o /dev/null btree_io.i
btree_io.i:16:3: warning: expression result unused [-Wunused-value]
16 | ret;
| ^~~
1 warning generated.
$ clang --target=hexagon-linux -O2 -c -o /dev/null btree_io.i -fno-PIE
btree_io.i:16:3: warning: expression result unused [-Wunused-value]
16 | ret;
| ^~~
clang: /home/nathan/cbl/src/patched/tc-build/src/llvm-project/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp:745: bool (anonymous namespace)::HexagonConstExtenders::ExtRoot::operator<(const HCE::ExtRoot &) const: Assertion `ThisB->getParent() == OtherB->getParent()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang --target=hexagon-linux -O2 -c -o /dev/null btree_io.i -fno-PIE
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'btree_io.i'.
4. Running pass 'Hexagon constant-extender optimization' on function '@__btree_node_lock_nopath'
...