Help for this page
#include <limits.h> #include <stdio.h> ... lval = lval * -1; // this is okay with -fwrapv printf("wrap lval %ld\n", lval); }
$ gcc -Wall -Wextra -Woverflow -fwrapv -fsanitize=undefined t.c -o t & +& ./t t.c: In function ‘main’: ... LONG_MAX 9223372036854775807 -LONG_MAX -9223372036854775808 wrap lval 9223372036854775807