Closed
Description
This appears to be a recent regression as it doesn't reproduce with 18.1.0 and earlier.
Compiler Explorer: https://godbolt.org/z/T9b4a7z3v
% clangtk -v
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 338cbfef03e0ab58d7b52f3301928c58b194a1b4)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
%
% clangtk -O0 small.c; ./a.out
% clangtk -O1 small.c
% ./a.out
Aborted
% cat small.c
int a;
char b(char c, char d) { return c - d; }
int main() {
int e;
for (a = -10; a > -11; a--)
e = b(a, -1);
if (e > -2)
__builtin_abort();
return 0;
}