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

            Bug ID: 105910
           Summary: ICE: with -O1 optimization level and code calling
                    __builtin_return_address
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: k.even-mendoza at imperial dot ac.uk
  Target Milestone: ---

This code (reduced): 
===
int a;
void b() {
  a = ((long)__builtin_return_address(0) ^ (long)__builtin_return_address(0)) *
      (long)__builtin_return_address(524288);
}
int main(void) { return 0;}
===
crashed the compiler with -O1: gcc -O1 test4.c

gcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.

====
It works fine with other optimization levels including -O0. It happens with
gcc-11, gcc-12 and gcc-13 (tested with 20220606); with gcc-10 and below it
seems to work fine also with -O1.

Reply via email to