我发现,将表达式除以0不会报告错误.如果有人能告诉我原因,我将不胜感激. 以下是代码
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
int main() {
int result = 3/10*(7/0);
printf("%d\n", result);
//printf("%" PRIu64, result);
return 0;
}
环境:
- Ubuntu 22.04
- GCC 11.3.0
I have used gdb to debug the program and i found the expression will be optimized by the compiler (my guess). so i suspect that it's a bug in gcc.