Skip to content

wrong code at -O{2,3} on x86_64-linux-gnu #108698

Closed
@zhendongsu

Description

@zhendongsu

It appears to be a recent regression as it doesn't reproduce with 18.1.0 and earlier.

Compiler Explorer: https://godbolt.org/z/EGasYh8x1

[691] % clangtk -v
clang version 20.0.0git (https://github.com/llvm/llvm-project.git 223e2efa5e886502a9467b7ef700ebce9b7886e8)
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
[692] % 
[692] % clangtk -O1 small.c; ./a.out
[693] % 
[693] % clangtk -O2 small.c
[694] % ./a.out
Aborted
[695] % 
[695] % cat small.c
char a[8];
int b = 1, c;
int main() {
  for (; c < 8; c++)
    a[c] = !c >> b;
  if (a[0] != 0)
    __builtin_abort();
  return 0;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions