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

            Bug ID: 122016
           Summary: [15/16 Regression] ICE: SSA corruption (Unable to
                    coalesce ssa_names 4 and 18 which are marked as MUST
                    COALESCE)
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

seen with the gcc-15 branch and the trunk, not with gcc-14. Can be worked
around by using -O1 instead of -O2:

$ cat merge.i
int merge_parse_args_argc;
char merge_parse_args_argv_0;
int strncmp(char *, char *, long);
void _setjmp();
typedef enum { FALSE, TRUE } bool;
void directory_exists();
void merge_parse_args() {
  int i;
  bool help_found = FALSE;
  while (i < merge_parse_args_argc && !help_found) {
    if (strncmp("", &merge_parse_args_argv_0, 2))
      help_found = TRUE;
    else {
      for (;;) {
        _setjmp();
        break;
      }
      i++;
      directory_exists();
    }
    i++;
  }
  _setjmp();
}

$ gcc -std=gnu17 -c -O2 merge.i

Unable to coalesce ssa_names 4 and 18 which are marked as MUST COALESCE.
i_4(ab) and  i_18(ab)
during RTL pass: expand
merge.i: In function 'merge_parse_args':
merge.i:7:6: internal compiler error: SSA corruption
    7 | void merge_parse_args() {
      |      ^~~~~~~~~~~~~~~~
0x15bf2a7 internal_error(char const*, ...)
        ../../src/gcc/diagnostic-global-context.cc:517
0x9c8ae1 fail_abnormal_edge_coalesce
        ../../src/gcc/tree-ssa-coalesce.cc:1014
0x9c8ae1 coalesce_partitions
        ../../src/gcc/tree-ssa-coalesce.cc:1446
0x9c8ae1 coalesce_ssa_name(_var_map*)
        ../../src/gcc/tree-ssa-coalesce.cc:1900
0x1bc6763 remove_ssa_form
        ../../src/gcc/tree-outof-ssa.cc:1070
0x1bc6763 rewrite_out_of_ssa(ssaexpand*)
        ../../src/gcc/tree-outof-ssa.cc:1408
0x18205e9 execute
        ../../src/gcc/cfgexpand.cc:7011
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.

Reply via email to