Description
come from rust-lang/rust#112061
alive2 complains about an optimization in the LLVM IR: https://alive2.llvm.org/ce/z/fyzhJ3
The code is quite big and I have made attempts to minimize it, but I didn't quite figure out the tooling, so I'm not sure whether my not very good minimizations would be useful. Everything can be found on https://github.com/Nilstrieb/rlo-issue-112061 if desired.
The program prints 11
on O0/O1 and 22
on O2.
This small helper must be linked in to run the program:
#include <stdio.h>
#include <stdint.h>
void print_var(uint8_t x) {
printf("%d", x);
}
void fn12_rs();
int main() {
fn12_rs();
}
I can't say for sure that the IR emitted by rustc is free of UB, but I suspect that this is the case. The code is really sensitive to small changes and rustc's constant propagation pass actually masks the miscompilation and has to be disabled.
@cbeuw suggested running LLVM built with ASan because they were facing crashes on similar input (#63013), but it did not show any issues.
Metadata
Metadata
Assignees
Type
Projects
Status