This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to make gcc warn about arithmetic signed overflow


On 2013-09-25 22:29:58 -0400, James K. Lowden wrote:
> You mean that a naïve rendering of the source code implies an overflow
> where none might exist in the actual emitted object code.  And,
> presumably, the converse: that even if the source is written such that
> there logically can't be an overflow, the compiler might render object
> code that does.

The converse is forbidden.

> I saw recommendations here for -ftrapv, said to be broken (?),
> defined only for signed integer operations, [...]

It's defined only for signed integer operations, because there
are never overflows with unsigned integer operations (except for
conversions from floating-point types).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]