This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Susprising behavior of gcc on x86 (-m32)
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 8 Sep 2015 14:22:58 +0100
- Subject: Re: Susprising behavior of gcc on x86 (-m32)
- Authentication-results: sourceware.org; auth=none
- References: <CA+7wUsydzQTunngu5x46MGJm5BqRbysPHL9G1if-Kpf2cAbBDg at mail dot gmail dot com> <55EEAE4A dot 40307 at redhat dot com> <CA+7wUsxqBk0DDVD5zX-c-ngUGMWTLPdr1n5707_G7A+cVhWdwA at mail dot gmail dot com> <CAH6eHdQ2mMTuue=+4OqL_1jpG2ET0EwCGDzhBJtHZDG=iz6F2Q at mail dot gmail dot com> <CA+7wUswSJ1auXVvTUxipske9JTbJbye0P42eyDhLkWh=J7jxEg at mail dot gmail dot com> <CA+7wUszRQuMGDKMx5-PXECHBeWFZfB=3Y2TqBjpFdJ-adi54_g at mail dot gmail dot com>
On 09/08/2015 01:40 PM, Mathieu Malaterre wrote:
> On Tue, Sep 8, 2015 at 2:00 PM, Mathieu Malaterre <malat@debian.org> wrote:
>> FYI,
>>
>> On Tue, Sep 8, 2015 at 12:04 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> [...]
>>> That's not the only option. You could compile one file with GCC and
>>> all others with Clang and see if you can reproduce it. Repeat for each
>>> file, which will narrow down the file where the problem occurs. Then
>>> you can try splitting that file into smaller pieces, with one function
>>> per file, and repeat the process. That would tell you which function
>>> or functions get miscompiled by GCC.
>>
>> Ok so if I compile eveything with gcc and then only `tcd.c` using
>> clang, then everything works as expected (no symptoms).
>> ref: https://github.com/uclouvain/openjpeg/blob/master/src/lib/openjp2/tcd.c
>>
>> I'll repeat your approach to find the culprit function.
>
> And the culprit function is `opj_tcd_makelayer`:
>
> https://github.com/uclouvain/openjpeg/blob/master/src/lib/openjp2/tcd.c#L218
>
> Other than the `if (dd / dr >= thresh)` I do not see anything
> obviously suspicious.
I see floating point, despite your earlier denial. :-)
Libopenjpeg has a bad reputation for messing with the floating-
point state. Please make sure the library is not linked with
-ffast-math.
Beyond that, a few printf()s and "diff" should find the problem.
Andrew.