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

            Bug ID: 79576
           Summary: [7 Regression] ICE in gimple_stmt_nonnegative_warnv_p
                    in gcc/gimple-fold.c:6979
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: kugan at gcc dot gnu.org, rguenth at gcc dot gnu.org
  Target Milestone: ---

Running following test-case:

$ cat ice.c
a, b;
c ()
{
  int d = 0;
  for (;;)
    if (b)
      while (a)
        d++;
}
$ gcc
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/pr24716.c
--param max-ssa-name-query-depth=10000000 -O2
gcc: internal compiler error: Segmentation fault (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

Triggers stack overflow in:

...
#29 0x000000000085cd3a in gimple_phi_nonnegative_warnv_p (depth=<optimized
out>, strict_overflow_p=<optimized out>, stmt=<optimized out>) at
../../gcc/gimple-fold.c:6954
#30 gimple_stmt_nonnegative_warnv_p (stmt=0x7ffff69c1100,
strict_overflow_p=0x7fffffffd34f, depth=5) at ../../gcc/gimple-fold.c:6979
#31 0x000000000085cd3a in gimple_phi_nonnegative_warnv_p (depth=<optimized
out>, strict_overflow_p=<optimized out>, stmt=<optimized out>) at
../../gcc/gimple-fold.c:6954
#32 gimple_stmt_nonnegative_warnv_p (stmt=0x7ffff69c1700,
strict_overflow_p=0x7fffffffd34f, depth=4) at ../../gcc/gimple-fold.c:6979
#33 0x000000000085cd3a in gimple_phi_nonnegative_warnv_p (depth=<optimized
out>, strict_overflow_p=<optimized out>, stmt=<optimized out>) at
../../gcc/gimple-fold.c:6954
#34 gimple_stmt_nonnegative_warnv_p (stmt=0x7ffff69c1000,
strict_overflow_p=0x7fffffffd34f, depth=3) at ../../gcc/gimple-fold.c:6979
#35 0x000000000085cd3a in gimple_phi_nonnegative_warnv_p (depth=<optimized
out>, strict_overflow_p=<optimized out>, stmt=<optimized out>) at
../../gcc/gimple-fold.c:6954
#36 gimple_stmt_nonnegative_warnv_p (stmt=0x7ffff69c1500,
strict_overflow_p=0x7fffffffd34f, depth=2) at ../../gcc/gimple-fold.c:6979
#37 0x000000000085cd3a in gimple_phi_nonnegative_warnv_p (depth=<optimized
out>, strict_overflow_p=<optimized out>, stmt=<optimized out>) at
../../gcc/gimple-fold.c:6954
#38 gimple_stmt_nonnegative_warnv_p (stmt=0x7ffff69c1600,
strict_overflow_p=0x7fffffffd34f, depth=1) at ../../gcc/gimple-fold.c:6979
#39 0x000000000085cd3a in gimple_phi_nonnegative_warnv_p (depth=<optimized
out>, strict_overflow_p=<optimized out>, stmt=<optimized out>) at
../../gcc/gimple-fold.c:6954
#40 gimple_stmt_nonnegative_warnv_p (stmt=0x7ffff69c1100,
strict_overflow_p=0x7fffffffd34f, depth=0) at ../../gcc/gimple-fold.c:6979
#41 0x000000000081a23e in tree_binary_nonzero_warnv_p (code=<optimized out>,
type=<optimized out>, op0=op0@entry=0x7ffff6881ab0,
op1=op1@entry=0x7ffff6893090,
strict_overflow_p=strict_overflow_p@entry=0x7fffffffd38b) at
../../gcc/fold-const.c:13217
#42 0x0000000000c8d923 in gimple_assign_nonzero_warnv_p
(strict_overflow_p=0x7fffffffd38b, stmt=0x7ffff69be000) at
../../gcc/tree-vrp.c:1050
#43 gimple_stmt_nonzero_warnv_p (strict_overflow_p=0x7fffffffd38b,
stmt=0x7ffff69be000) at ../../gcc/tree-vrp.c:1074
#44 vrp_stmt_computes_nonzero (strict_overflow_p=0x7fffffffd38b,
stmt=0x7ffff69be000) at ../../gcc/tree-vrp.c:1118
#45 extract_range_basic (vr=vr@entry=0x7fffffffd550,
stmt=stmt@entry=0x7ffff69be000) at ../../gcc/tree-vrp.c:4175
#46 0x0000000000c8e144 in extract_range_from_assignment
(vr=vr@entry=0x7fffffffd550, stmt=stmt@entry=0x7ffff69be000) at
../../gcc/tree-vrp.c:4218
#47 0x0000000000c8e992 in vrp_visit_assignment_or_call (vr=0x7fffffffd550,
output_p=0x7fffffffd430, stmt=0x7ffff69be000) at ../../gcc/tree-vrp.c:7423
#48 extract_range_from_stmt (stmt=stmt@entry=0x7ffff69be000,
taken_edge_p=taken_edge_p@entry=0x7fffffffd528,
output_p=output_p@entry=0x7fffffffd520, vr=vr@entry=0x7fffffffd550) at
../../gcc/tree-vrp.c:8243
#49 0x0000000000c8f0a6 in evrp_dom_walker::before_dom_children
(this=0x7fffffffd660, bb=0x7ffff68823a8) at ../../gcc/tree-vrp.c:11262
#50 0x00000000011a98a3 in dom_walker::walk (this=this@entry=0x7fffffffd660,
bb=0x7ffff68823a8) at ../../gcc/domwalk.c:265
#51 0x0000000000c76820 in execute_early_vrp () at ../../gcc/tree-vrp.c:11486
#52 (anonymous namespace)::pass_early_vrp::execute (this=<optimized out>) at
../../gcc/tree-vrp.c:11735
#53 0x00000000009c4d5e in execute_one_pass (pass=pass@entry=0x1f45050) at
../../gcc/passes.c:2465
#54 0x00000000009c5568 in execute_pass_list_1 (pass=0x1f45050) at
../../gcc/passes.c:2554
#55 0x00000000009c557a in execute_pass_list_1 (pass=0x1f44cd0) at
../../gcc/passes.c:2555
#56 0x00000000009c55c5 in execute_pass_list (fn=<optimized out>,
pass=<optimized out>) at ../../gcc/passes.c:2565
#57 0x00000000009c3b7b in do_per_function_toporder
(callback=callback@entry=0x9c55b0 <execute_pass_list(function*, opt_pass*)>,
data=0x1f44b50) at ../../gcc/passes.c:1730
#58 0x00000000009c5c17 in execute_ipa_pass_list (pass=0x1f44af0) at
../../gcc/passes.c:2907
#59 0x000000000074dec5 in ipa_passes () at ../../gcc/cgraphunit.c:2323
#60 symbol_table::compile (this=this@entry=0x7ffff687a100) at
../../gcc/cgraphunit.c:2462
#61 0x000000000074fc25 in symbol_table::compile (this=0x7ffff687a100) at
../../gcc/cgraphunit.c:2595
#62 symbol_table::finalize_compilation_unit (this=0x7ffff687a100) at
../../gcc/cgraphunit.c:2621
#63 0x0000000000a8950a in compile_file () at ../../gcc/toplev.c:492
#64 0x00000000006085d7 in do_compile () at ../../gcc/toplev.c:1984
#65 toplev::main (this=this@entry=0x7fffffffd8e0, argc=<optimized out>,
argc@entry=21, argv=<optimized out>, argv@entry=0x7fffffffd9e8) at
../../gcc/toplev.c:2118
#66 0x000000000060a907 in main (argc=21, argv=0x7fffffffd9e8) at
../../gcc/main.c:39

Started with introduction of Early VRP (r240291), but I guess it can happen
with the crazy param in different places.
Should we do a reasonable limit for max-ssa-name-query-depth?

Reply via email to