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

            Bug ID: 123399
           Summary: ICE: 'verify_gimple' failed with
                    __sync_val_compare_and_swap and __int128 pointer cast
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

Reproducer: https://godbolt.org/z/Y6jbfbf64

The compiler crashes with an ICE when a string literal (pointer) is cast to
__int128_t and passed as an argument to the legacy atomic builtin
__sync_val_compare_and_swap. The error occurs during the GIMPLE verification
phase.

```c
int main() {
    __int128_t v = 0;
    __sync_val_compare_and_swap(&v, 0, (__int128_t)"XOR");
    return 0;
}
```

Traceback:
```
internal compiler error: 'verify_gimple' failed
0x5da1dc8 internal_error(char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:517
0x27e6c81 verify_gimple_in_seq(gimple*, bool)
        /workspace/install/gcc/src/gcc/gcc/tree-cfg.cc:5332
0x1f7ad71 gimplify_body(tree_node*, bool)
        /workspace/install/gcc/src/gcc/gcc/gimplify.cc:20916
0x1f7b748 gimplify_function_tree(tree_node*)
        /workspace/install/gcc/src/gcc/gcc/gimplify.cc:21042
0x1a64ddf cgraph_node::analyze()
        /workspace/install/gcc/src/gcc/gcc/cgraphunit.cc:689
0x1a6900b analyze_functions
        /workspace/install/gcc/src/gcc/gcc/cgraphunit.cc:1265
0x1a6f5c9 symbol_table::finalize_compilation_unit()
        /workspace/install/gcc/src/gcc/gcc/cgraphunit.cc:2574
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```

Reply via email to