------- Additional Comments From l_belev at yahoo dot com 2005-02-11 23:09 ------- (In reply to comment #1) > Note that the first expression can involve undefined behavior when the > second doesn't, so transformations between these forms would be invalid > with -ftrapv and until we have internal overflow flags on expressions we > could only transform in one direction without -fwrapv.
The compiler does know what options are passed to it, so it can disable such transformations in the rare cases when -ftrapv is specified. I dont understand what the purpose of -fwrapv is, because the compiler always knows whether the machine it's currently generating code for, wraps around the results on arithmetic overflow. Anyway surely the first consideration applies in this case too, that is, the transformations could be disabled if they are not applicable. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19912