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

--- Comment #3 from Patrick O'Neill <patrick at rivosinc dot com> ---
(In reply to Xi Ruoyao from comment #2)
> Maybe add __attribute__((noipa)) for test() and merge the files.

That worked, thanks!

Testcase:
int a = 2;
unsigned b = 0x80000000;
int arr_5[2][23];
void test(int, unsigned, int);
int main() {
  test(a, b, 1);
  __builtin_printf("%d\n", arr_5[1][0]);
}

#define c(a, b)                                                               
\
  ({                                                                          
\
    long d = a;                                                               
\
    long e = b;                                                               
\
    d > e ? d : e;                                                            
\
  })
__attribute__((noipa))
void test(int f, unsigned g, int h) {
  for (int i = 0; i < h; i = f)
    arr_5[1][i] = h ? c(g, 7) : 0;
}

Commands:
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
>  -march=rv64id_zbb -O2 red.c -o user-config.out
> QEMU_CPU=rv64,vlen=128,rvv_ta_all_1s=true,rvv_ma_all_1s=true,v=true,vext_spec=v1.0,zve32f=true,zve64f=true,zbb=true
>  timeout --verbose -k 0.1 4 
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/qemu-riscv64 
> user-config.out
7

> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
>  -march=rv64id_zbb -O1 red.c -o user-config.out
> QEMU_CPU=rv64,vlen=128,rvv_ta_all_1s=true,rvv_ma_all_1s=true,v=true,vext_spec=v1.0,zve32f=true,zve64f=true,zbb=true
>  timeout --verbose -k 0.1 4 
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/qemu-riscv64 
> user-config.out
-2147483648

Reply via email to