public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113603] New: [14 Regression] ICE Segfault during GIMPLE pass: strlen at -O3
@ 2024-01-25 19:18 patrick at rivosinc dot com
  2024-01-25 20:06 ` [Bug tree-optimization/113603] [12/13/14 Regression] ICE Segfault during GIMPLE pass: strlen at -O3 since r12-145 jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: patrick at rivosinc dot com @ 2024-01-25 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113603
           Summary: [14 Regression] ICE Segfault during GIMPLE pass:
                    strlen at -O3
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Command:
> /scratch/tc-testing/tc-jan-8-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -O3 red.c -S -freport-bug
during GIMPLE pass: strlen
red.c: In function 'h':
red.c:7:6: internal compiler error: Segmentation fault
    7 | int *h() {
      |      ^
0x12c0303 crash_signal
        ../../../gcc/gcc/toplev.cc:316
0x7fe82a04251f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x14f03cc contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../../gcc/gcc/tree.h:3757
0x14f03cc maybe_invalidate
        ../../../gcc/gcc/tree-ssa-strlen.cc:1361
0x14f0861 do_invalidate
        ../../../gcc/gcc/tree-ssa-strlen.cc:5730
0x150015e strlen_pass::before_dom_children(basic_block_def*)
        ../../../gcc/gcc/tree-ssa-strlen.cc:5780
0x23cb957 dom_walker::walk(basic_block_def*)
        ../../../gcc/gcc/domwalk.cc:311
0x15006e6 printf_strlen_execute
        ../../../gcc/gcc/tree-ssa-strlen.cc:5899
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.

Testcase:
int a, e;
char b;
int *c;
signed char *d;
short f;
char g[3];
int *h() {
  int i = 0;
  for (; i < 3; i++)
    g[i] = 2;
  int j[100][100] = {{}, {4}};
  signed char *k = &g[1];
  do {
    for (;;) {
      if (c)
        break;
      return &a;
    }
    f = 0;
    for (;; f++) {
      b = 0;
      for (; b < 2; b++)
        *c = j[b][f];
      if (e)
        d = k;
      *k = *d;
      if (*c)
        break;
      if (f)
        break;
    }
  } while (f);
  return 0;
}

Godbolt:
https://godbolt.org/z/ax1Tzc3To

Occurs on x86, RISC-V, ARM
Found using a fuzzer.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-06-20 13:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 19:18 [Bug tree-optimization/113603] New: [14 Regression] ICE Segfault during GIMPLE pass: strlen at -O3 patrick at rivosinc dot com
2024-01-25 20:06 ` [Bug tree-optimization/113603] [12/13/14 Regression] ICE Segfault during GIMPLE pass: strlen at -O3 since r12-145 jakub at gcc dot gnu.org
2024-01-29 15:28 ` jakub at gcc dot gnu.org
2024-01-30  8:59 ` cvs-commit at gcc dot gnu.org
2024-01-30  9:04 ` [Bug tree-optimization/113603] [12/13 " jakub at gcc dot gnu.org
2024-03-02  0:38 ` cvs-commit at gcc dot gnu.org
2024-03-04 12:13 ` [Bug tree-optimization/113603] [12 " jakub at gcc dot gnu.org
2024-06-11 10:36 ` cvs-commit at gcc dot gnu.org
2024-06-11 10:49 ` jakub at gcc dot gnu.org
2024-06-20 13:22 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).