The following program segfaults for me when compiled and run:
```
#include <cstdarg>
struct Foo {
char *buf0;
char *buf1;
};
void (*x)(Foo *);
static void x_impl(Foo *) {}
void vfoo(char *buf0, const char *, va_list ap) {
char buf1[80];
Foo f{.buf0 = buf0, .buf1 = buf1};
x = x_impl;
va_list ap2;
va_copy(ap2, ap);
x(&f);
va_end(ap2);
}
void foo(const char *format, ...) {
va_list ap;
va_start(ap, format);
char buffer[4096];
vfoo(buffer, format, ap);
va_end(ap);
}
int main(int argc, char **argv) {
foo("");
return 0;
}
```
Using
`clang ... -O1 -mrvv-vector-bits=512 -target riscv64-unknown-linux -march=rv64gcv1p0 ...`
(... includes flags I don't think are relevant, like paths about my environment etc, and - among other things - examining the output assembly)
This problem started for me at the merge of
https://github.com/llvm/llvm-project/pull/110809
This tarball contains the source above, and the assembly I get with and without the problem.
[riscv-varargs-crash.tgz](https://github.com/user-attachments/files/17497474/riscv-varargs-crash.tgz)
The differences in the assembly do look to me like probably results of the above merge.
The following program segfaults for me when compiled and run:
Using
clang ... -O1 -mrvv-vector-bits=512 -target riscv64-unknown-linux -march=rv64gcv1p0 ...
(... includes flags I don't think are relevant, like paths about my environment etc, and - among other things - examining the output assembly)
This problem started for me at the merge of https://github.com/llvm/llvm-project/pull/110809
This tarball contains the source above, and the assembly I get with and without the problem. riscv-varargs-crash.tgz
The differences in the assembly do look to me like probably results of the above merge.