This is the mail archive of the gcc@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: [RFC] Detect most integer overflows.


On Sat, Apr 12, 2014 at 12:53:45AM +0200, Hannes Frederic Sowa wrote:
> Hi!
> 
> On Tue, Oct 29, 2013 at 10:41:56AM +0100, Richard Biener wrote:
> > For a "quick" GCC implementation of the builtins you could expand
> > them to a open-coded sequence during gimplification.  But due to
> > the issues pointed out above I'm not sure it is the best interface
> > to support (though now the names are taken).
> 
> I played around with gcc internals for the first time today and came
> up with this. As this is my first patch to gcc I am very happy to hear
> feedback. Thanks!
> 
Did you looked at resulting assembly for simple expressions?

Also Paul Eggert suggested at another list[1] to implement these with
128bit arithmetic which gcc can optimize quite well, it uses overflow
flag as check.

Could these builtins use a 128bit arithmetic as well?

P.S.

A generated code is affected by generic gcc bug that gcc uses
conditional move instruction even when branch is very unlikely and 
jump would be faster.

[1] https://sourceware.org/ml/libc-alpha/2013-12/msg00084.html


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