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

            Bug ID: 123645
           Summary: [12-16 Regression] Miscompile at -O1
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xxs_chy at outlook dot com
  Target Milestone: ---

Reproducer:https://godbolt.org/z/Gv48hvs6d
Testcase:
#include <stdint.h>
#define BS_VEC(type, num) type __attribute__((vector_size(num * sizeof(type))))
uint64_t BS_CHECKSUM_ARR[];
uint64_t backsmith_pure_7(BS_VEC(int32_t, 8) BS_ARG_3)
{
    BS_VEC(uint16_t, 32) BS_VAR_2[6];
    if (BS_ARG_3[7]) return 4083;
    return BS_VAR_2[0][7];
}
void func_1()
{
    BS_VEC(int8_t, 2) BS_VAR_2[1];
    uint64_t LOCAL_CHECKSUM;
    uint64_t a = backsmith_pure_7((BS_VEC(int32_t, 8)){
        1804204987, -1309346951, -1206475732, -1915627388, -1650274770,
        -864627244, -1547892255, 2053041296 });
    BS_VAR_2[a < 1 ? __builtin_bswap64(a) : 0] = (BS_VEC(int8_t, 2)){};
    for (uint32_t BS_TEMP_667 = 0; BS_TEMP_667 < 1; BS_TEMP_667++)
        for (uint32_t BS_TEMP_668 = 0; BS_TEMP_668 < 2; BS_TEMP_668++)
            LOCAL_CHECKSUM ^= BS_VAR_2[BS_TEMP_667][BS_TEMP_668];
    BS_CHECKSUM_ARR[0] += LOCAL_CHECKSUM;
}
int main() { func_1(); }

Exit code is 0 at -O0.
SIGBUS at -O1.

Reply via email to