Jeffrey Walton <noloader@xxxxxxxxx> writes: > A simplified example (I know you gave a previous work around) assuming > 32 bit ints: > > // liboverflow, compiled with -fwrapv > int my_abs(int x, int* r) > { > int y = abs(x); > if (y < 0) > return 0; > > *r = y; > return 1; > } > > // myprogram, compiled with -O2 and linked against liboverflow > int x = 0x80000000, r = 0; > if(my_abs(x, &r)) > printf(...) > > Will the resulting program enjoy O2 and/or produce incorrect results? If you are asking whether this program has signed overflow problems, the answer is no. Compiling liboverflow with -fwrapv does not affect myprogram. Similarly, compiling myprogram without -fwrapv does not affect liboverflow. Ian