Issue 245067
Summary [RISCV][P-ext] Wrong code at -Os
Labels backend:RISC-V, miscompilation, generated by fuzzer
Assignees
Reporter XChy
    Reduced case:
```c
long n = 1, x;
char p;
int y __attribute__((vector_size(64)));
long b __attribute__((vector_size(128)));
void f()
{
    typeof(b) v;
    p = x = ((long[2]){ 0x261dd3fd112f45 })[x];
    v = __builtin_shufflevector(b, b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 30, 0);
    int u = (v <= b)[14];
    u *= u;
    if (p)
    {
        v = v <= (v <= b);
        if (__builtin_mul_overflow(u, n, &(long){})) return;
    }
    y = __builtin_convertvector(v, typeof(y));
    n = y[0];
}
int main()
{
    while (n) f();
}
```

This case triggers a segfault at -Os and terminates normally at -O0. I run it with https://github.com/ruyisdk/qemu/tree/p-dev.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to