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

            Bug ID: 127533
           Summary: [GIMPLE FE] malformed __PHI (missing/mismatched
                    arguments) crashes in find_edge /
                    walk_stmt_load_store_addr_ops
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: captainnemo9292 at gmail dot com
  Target Milestone: ---
            Target: x86_64-linux-gnu

__PHI arguments are not checked against the predecessors of the block, so a
PHI with the wrong number of arguments, or an argument without a __BBn: edge
label, produces a phi node whose edges cannot be resolved.

Argument without an edge label in a block with no predecessors:

  void __GIMPLE (ssa) a() {
    int p;
    __BB(2):
    p_1 = __PHI (6);
  }
  $ gcc -fgimple -c t.c
  t.c:5:1: internal compiler error: Segmentation fault
  find_edge(basic_block_def*, basic_block_def*)
  c_parser_parse_gimple_body
  https://godbolt.org/z/bvMGd5TfK

Empty __PHI ():

  void __GIMPLE (ssa) a() {
    int context;
    __BB(3):
    context_448 = __PHI ();
    if (0) goto __BB999; else goto __BB7;
    __BB(7):
    __BB(999):
  }
  -O2: Segmentation fault in walk_stmt_load_store_addr_ops <-
cgraph_edge::rebuild_edges
  https://godbolt.org/z/rfze87zbs

Fewer arguments than predecessors, undeclared operands:

  void __GIMPLE (ssa) a() {
    int p;
    __BB(2):
    p_5 = __PHI (c);
    if (b) goto __BB4; else goto __BB5;
    __BB(4):
    __BB(5):
  }
  internal compiler error: tree check: expected integer_cst, have error_mark in
c_parser_parse_gimple_body, at c/gimple-parser.cc:374
  https://godbolt.org/z/czndnxsx5

gcc trunk 17.0.0 20260920.
  • [Bug c/127533] New: [GIMPLE ... captainnemo9292 at gmail dot com via Gcc-bugs

Reply via email to