This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Detect most integer overflows.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Hannes Frederic Sowa <hannes at stressinduktion dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "gcc at gnu dot org" <gcc at gnu dot org>
- Date: Thu, 17 Apr 2014 16:20:06 +0200
- Subject: Re: [RFC] Detect most integer overflows.
- Authentication-results: sourceware.org; auth=none
- References: <20131026192912 dot GA25428 at domone dot podge> <20131026235014 dot GF18009 at order dot stressinduktion dot org> <CAFiYyc0+wTbE1FwwLscquWvoEtM6JQw4p5qhnhBmGtVCMkx9fQ at mail dot gmail dot com> <20140411225345 dot GQ16157 at order dot stressinduktion dot org>
On Sat, Apr 12, 2014 at 12:53:45AM +0200, Hannes Frederic Sowa wrote:
> 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 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?
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.