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

            Bug ID: 121380
           Summary: ice with -O1 -fexceptions -favoid-store-forwarding
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this C code:

int selected_connection;
char string2num_sn[];
void *memcpy(void *, void *, long);
char string2num() {
  string2num_sn[1] = 0;
  string2num_sn[0] = string2num();
  memcpy(&selected_connection, string2num_sn, 8);
}

compiled by recent gcc, does this:

$ ~/gcc/results.20250729.asan.ubsan/bin/gcc -c -w -freport-bug  -O1
-fexceptions -favoid-store-forwarding bug1113b.c
$ ~/gcc/results.20250730.asan.ubsan/bin/gcc -c -w -freport-bug  -O1
-fexceptions -favoid-store-forwarding bug1113b.c
during RTL pass: avoid_store_forwarding
bug1113b.c: In function ‘string2num’:
bug1113b.c:8:1: internal compiler error: Segmentation fault
    8 | }
      | ^
0x1ec51ce ???
       
/home/dcb42/gcc/working/gcc/../../trunk/gcc/diagnostic-global-context.cc:534
0xc34f79 ???
        /home/dcb42/gcc/working/gcc/../../trunk/gcc/toplev.cc:323
0xc274ae is_constant<long>
        ../../trunk/gcc/poly-int.h:576
0xc274ae is_store_forwarding
       
/home/dcb42/gcc/working/gcc/../../trunk/gcc/avoid-store-forwarding.cc:152

$ ~/gcc/results.20250729.asan.ubsan/bin/gcc -v 2>&1 | grep exp
gcc version 16.0.0 20250729 (experimental) (b87d6ae3988e9d31) 
$ ~/gcc/results.20250730.asan.ubsan/bin/gcc -v 2>&1 | grep exp
gcc version 16.0.0 20250730 (experimental) (d7cd6b0df54a29e2) 
$ 

$ git log b87d6ae3988e9d31..d7cd6b0df54a29e2 | grep -c "^commit"
58
$

Reply via email to