1

It's a simple code as following:

#include <stdio.h>
#include <stdint.h>
#include <limits.h>
int main(){
    int b = INT_MIN;
    int c = -1;
    int a = b/c;
}

When running the code after compilation, a SIGFPE appears:

[1]    27835 floating point exception (core dumped)  /tmp/a

My system info:
kernel: 4.19.0-5-amd64
CPU: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
gcc version 8.3.0

I intend to see the signed int overflow of division. However I am very confused at signal FPE because no calculation on float.

H Han
  • 37
  • 3

0 Answers0