Susprising behavior of gcc on x86 (-m32)
Mathieu Malaterre
malat@debian.org
Tue Sep 8 13:19:00 GMT 2015
On Tue, Sep 8, 2015 at 3:16 PM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2015.09.08 at 14:40 +0200, 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.
>
> Looks like a x87 vs. SSE2 issue. You could try adding "-msse2
> -mfpmath=sse" for the -m32 case.
Indeed that fixes the symptoms. I'll check with upstream how best to
rewrite the floating point comparison.
Thx for the help everyone.
More information about the Gcc-help
mailing list