This is the mail archive of the
mailing list for the GCC project.
Re: Chasing a potential wrong-code bug on trunk
- From: Martin Reinecke <martin at MPA-Garching dot MPG dot DE>
- To: Markus Trippelsdorf <markus at trippelsdorf dot de>
- Cc: gcc at gcc dot gnu dot org, rguenther at suse dot de
- Date: Thu, 17 Nov 2016 11:27:20 +0100
- Subject: Re: Chasing a potential wrong-code bug on trunk
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org> <20161117095348.GA436@x4>
I feel deeply embarrassed now ... the sanitizer indeed found a spot
where I relied on (undefined) semantics of signed integer overflow.
Changing the offending "int" to "unsigned" fixed the problem.
Thanks a lot for the tip - I will definitely use the sanitizers more
often in the future!
Sorry for the noise,
On 11/17/16 10:53, Markus Trippelsdorf wrote:
> On 2016.11.17 at 10:49 +0100, Martin Reinecke wrote:
>> At some point in May 2016 there was a patch to the gcc trunk which
>> caused one of my numerical codes to give incorrect results when compiled
>> with this gcc version. This may of course be caused by some undefined
>> behavior I'm unknowingly invoking in the code, or it may be a code
>> generation bug in gcc. I tried to isolate the exact gcc commit that
>> caused the change, but I got stuck...
> You should check this first by compiling with -fsanitize=undefined and
> fixing all issues that may pop up.