https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114247
--- Comment #8 from Patrick O'Neill <patrick at rivosinc dot com> ---
Adjusted testcase:
union a {
unsigned short b;
int c;
signed short d;
};
int e, f = 1, g;
long h;
const int **i;
void j(union a k, int l, unsigned m) {
const int *a[100];
i = &a[0];
h = k.d;
}
static int o(union a k) {
k.d = -1;
while (1)
if (f)
break;
j(k, g, e);
return 0;
}
int main() {
union a n = {1};
o(n);
if (h != -1)
__builtin_abort();
}
Commands:
> /scratch/tc-testing/tc-apr-4/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc
> -O2 test.c -o user-config.out -fsigned-char -fno-strict-aliasing -fwrapv
> /scratch/tc-testing/tc-apr-4/build-rv64gcv/bin/qemu-riscv64 user-config.out
> /scratch/tc-testing/tc-apr-4/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc
> -O3 test.c -o user-config.out -fsigned-char -fno-strict-aliasing -fwrapv
> /scratch/tc-testing/tc-apr-4/build-rv64gcv/bin/qemu-riscv64 user-config.out
zsh: IOT instruction (core dumped)
/scratch/tc-testing/tc-apr-4/build-rv64gcv/bin/qemu-riscv64 user-config.out