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

            Bug ID: 127534
           Summary: [GIMPLE FE] SSA names accepted where they are not
                    valid: as ARRAY_REF base, in a non-SSA body, or
                    without a definition
           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

Three related holes in how the GIMPLE parser handles names of the form x_N:

1. An SSA name used as the base of an array reference. The parser builds
   a_10[0] as an ARRAY_REF with an SSA_NAME base (instead of requiring
   __MEM), and the operand scanner asserts:

  void __GIMPLE (ssa) b(int *a) {
    __BB(2):
    a_10[0] = 0;
  }
  $ gcc -fgimple -c t.c
  internal compiler error: in get_expr_operands, at tree-ssa-operands.cc:943
  operands_scanner::get_expr_operands <- parse_ssa_operands <-
build_ssa_operands <- update_stmt_operands <- c_parser_parse_gimple_body
  https://godbolt.org/z/r6hq3z41c

2. An SSA-style name in a body that is not in SSA form. a_10 is created
   with no usable type and build2 is called with mismatched operand types:

  void __GIMPLE b(int *a) {
    int c; int d;
    a_10 = c + d;
  }
  internal compiler error: in build2, at tree.cc:5312
  https://godbolt.org/z/v4aPfs7M8

3. A use of an SSA version that is never defined; update_ssa runs on the
   half-built function:

  void __GIMPLE (ssa) a() {
    int i;
    __BB(3):
    i = i_1;
    goto __BB4;
    __BB(4):
  }
  internal compiler error: SSA corruption
  update_ssa <- c_parser_parse_gimple_body
  https://godbolt.org/z/fP5Mreo4e

gcc trunk 17.0.0 20260920.

Reply via email to