[Bug tree-optimization/107976] New: ICE: SIGSEGV (stack overflow) in emit_case_dispatch_table (stmt.cc:783) with large --param=jump-table-max-growth-ratio-for-speed

zsojka at seznam dot cz gcc-bugzilla@gcc.gnu.org
Mon Dec 5 18:53:03 GMT 2022


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

            Bug ID: 107976
           Summary: ICE: SIGSEGV (stack overflow) in
                    emit_case_dispatch_table (stmt.cc:783) with large
                    --param=jump-table-max-growth-ratio-for-speed
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 54018
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54018&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc
--param=jump-table-max-growth-ratio-for-speed=1813160384 testcase.c 
x86_64-pc-linux-gnu-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.


Program received signal SIGSEGV, Segmentation fault.
0x000000000138aa18 in emit_case_dispatch_table (index_expr=0x7ffff770be58,
index_type=0x7ffff771f5e8, case_list=..., default_label=0x7ffff771a2c0,
default_edge=0x7ffff78d23f0, minval=0x7ffff7885fc0, maxval=0x7ffff78b59d8,
range=0x7ffff78d7a98, stmt_bb=0x7ffff78ad600) at
/repo/gcc-trunk/gcc/stmt.cc:783
783       memset (labelvec, 0, ncases * sizeof (rtx));
(gdb) list
778     
779       /* Get table of labels to jump to, in order of case index.  */
780     
781       ncases = tree_to_shwi (range) + 1;
782       labelvec = XALLOCAVEC (rtx, ncases);
783       memset (labelvec, 0, ncases * sizeof (rtx));
784     
785       for (unsigned j = 0; j < case_list.length (); j++)
786         {
787           simple_case_node *n = &case_list[j];
(gdb) p ncases
$1 = 69108865


More information about the Gcc-bugs mailing list