[gambit-list] Re: configure must use -fwrapv as a gcc option for building gambit
Bradley Lucier
lucier at math.purdue.edu
Fri Jun 3 16:03:13 EDT 2005
On Jun 3, 2005, at 3:58 PM, feeley at iro.umontreal.ca wrote:
> Quoting Bradley Lucier <lucier at math.purdue.edu>:
>
>> Here's the documentation for -fwrapv in gcc-4.0 in
>>
>> http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Code-Gen-
>> Options.html#Code-
>> Gen-Options
>>
>> -fwrapv
>> This option instructs the compiler to assume that signed
>> arithmetic
>> overflow of addition, subtraction and multiplication wraps around
>> using
>> twos-complement representation. This flag enables some optimizations
>> and disables other. This option is enabled by default for the Java
>> front-end, as required by the Java language specification.
>>
>>
>> Since we assume this of all processors, we need to enable this flag.
>>
>> Brad
>>
>
> You mean by default gcc will not wrap? This sounds bogus because it
> would
> cause major backward compatibility problems. What happens if you don't
> specify the flag?
By default, signed integer overflow is undefined in C, so if it occurs
in a C program, the program is undefined, so gcc can assume that it
doesn't occur and can enable some optimizations that assume it never
occurs. You don't want this to happen,
Brad
More information about the Gambit-list
mailing list