https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108365

            Bug ID: 108365
           Summary: [9/10/11/12/13 Regression] Wrong code with -O0
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskiy at gmail dot com
  Target Milestone: ---

Link to the Compiler Explorer: https://godbolt.org/z/rMaofso7E

Reproducer:
char b[23] = {1};
int main() {
    for (;short(long((unsigned long)(-2147483647 - 1)) / long(b[0] ? -1 :
0)););
}

Error:
>$ g++ -O0 repr.cpp && ./a.out 
Floating point exception (core dumped)

gcc version 13.0.0 20230110 (e9a39ad7936815980013605b052b12425d56ead8)

Reply via email to