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

            Bug ID: 121650
           Summary: [ICE] internal compiler error: in
                    try_make_edge_direct_simple_call, at ipa-prop.cc:4052
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: njuwy at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/Ph49hPcf7

The crash triggering program (compile with `gcc-16 -O2`):
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void process_func(void (*func)(void), int op);
__attribute__((target_clones("default", "sse4.2")))
void worker(void) {
    const char format[] = "Value: %.2f";
    char buffer[64];
    float val = 42.0f;
    int len = strfromf(buffer, sizeof(buffer), format, val);
    if (len > 0 && len < sizeof(buffer)) {
        puts(buffer);
    }
}
__attribute__((target_clones("default", "avx", "avx2")))
void controller(void) {
    static int count = 0;
    if (++count % 2 == 0) {
        process_func(worker, 1);
    } else {
        process_func(worker, 0);
    }
}
void process_func(void (*func)(void), int op) {
    if (op) {
        size_t offset = op * 8;
        char mempool[128];
        memset(mempool, 0, sizeof(mempool));
        mempool[offset] = 1;
        if (mempool[offset]) func();
    } else {
        return;
    }
}
int main(void) {
    for (int i = 0; i < 3; ++i) {
        controller();
    }
    return EXIT_SUCCESS;
}
```

The crash output:
```
during IPA pass: inline
<source>:38:1: internal compiler error: in try_make_edge_direct_simple_call, at
ipa-prop.cc:4052
   38 | }
      | ^
0x2562545 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2557b66 internal_error(char const*, ...)
        ???:0
0xa0885e fancy_abort(char const*, int, char const*)
        ???:0
0xf23fb3 ipa_propagate_indirect_call_infos(cgraph_edge*, vec<cgraph_edge*,
va_heap, vl_ptr>*)
        ???:0
0xeecf9c inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*,
int*, bool, bool*)
        ???:0
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.
Compiler returned: 1
```
  • [Bug ipa/121650] New: [ICE] int... njuwy at smail dot nju.edu.cn via Gcc-bugs

Reply via email to