You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main()
{
unsigned long long tmp1,tmp2;
tmp1 = 0xb2d05e00;
tmp2 = 1092471462 + 26000*60000;
if(tmp1 > tmp2)
printf("tmp1 > tmp2\n");
else
printf("tmp1 < tmp2\n");
return 0;
}
`
`
riscv64-unknown-elf-gcc ilp32long_long/test.c -Woverflow -o 64ilp32 (64ilp32)
ilp32long_long/test.c: In function 'main':
ilp32long_long/test.c:7:23: warning: integer overflow in expression of type 'int' results in
'-1642495834' [-Woverflow]
7 | tmp2 = 1092471462 + 26000*60000;
qemu-riscv64ilp32 64ilp32
tmp1 < tmp2
riscv64-unknown-elf-gcc ilp32long_long/test.c -Woverflow -o 64lp64
ilp32long_long/test.c: In function 'main':
ilp32long_long/test.c:7:23: warning: integer overflow in expression of type 'int' results in
'-1642495834' [-Woverflow]
7 | tmp2 = 1092471462 + 26000*60000;
qemu-riscv64 64lp64
tmp1 < tmp2
1、我们在用rv64ilp32 工具链测试uint64 类型(unsigned long long)数据加法和除法时出现了一个反常现象。
如下图代码所示,tmp1和tmp2是两个uint64 类型(unsigned long long)数据。tmp1应该大于tmp2,但是在if语句中判断出来的结果却是tmp1小于tmp2。如果把tmp1和tmp2除以2的话,tmp2的值反而变大了。请帮忙排查一下原因。源代码和测试打印如下图。
uint64类型数据加法测试代码:
uint64类型数据加法测试打印:
uint64类型数据加法除法测试代码:
uint64类型数据加法除法测试打印:
The text was updated successfully, but these errors were encountered: