This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Detect most integer overflows.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: Marek Polacek <polacek at redhat dot com>, Hannes Frederic Sowa <hannes at stressinduktion dot org>, gcc at gnu dot org
- Date: Sun, 27 Oct 2013 14:15:57 +0100
- 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> <20131027064803 dot GA31927 at domone dot podge> <20131027105100 dot GJ27400 at redhat dot com> <20131027113524 dot GA4618 at domone dot podge>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sun, Oct 27, 2013 at 12:35:24PM +0100, OndÅej BÃlka wrote:
> On Sun, Oct 27, 2013 at 11:51:00AM +0100, Marek Polacek wrote:
> > Or just wait till the integer overflow detection in ubsan is completed.
> >
> As these computations now are done on unsigned type which has behaviour
> defined as modular arithmetic this would not help.
But what is integer overflow on unsigned type? If you want to add -1
in unsigned arithmetics, you add very large positive number instead and that
would overflow, even if it is unlikely it is an error and it is pretty common.
As part of ubsan or follow-up to that we probably want to add some builtins
for these, the question is what semantics to implement.
Jakub