On Tue, Sep 8, 2015 at 12:04 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On 8 September 2015 at 10:57, Mathieu Malaterre <malat@xxxxxxxxxx> wrote: >> On Tue, Sep 8, 2015 at 11:45 AM, Andrew Haley <aph@xxxxxxxxxx> wrote: >>> On 09/08/2015 10:15 AM, Mathieu Malaterre wrote: >>>> What is even more surprising is that I can no longer reproduce the >>>> behavior using `valgrind` from my 32bits chroot. >>>> >>>> I understand that my bug description is relatively small, but I am >>>> eager to report a more specific gcc issue. If anyone could help me >>>> narrow down this issue, I'd appreciate your comments. >>>> >>>> Please note that that I disabled any kind of optimizations by using >>>> (explicitly!) -O0. >>> >>> I'm guessing that it's some silliness with the FPU, but that's a wild >>> guess. > > That was my first thought too. To rule it out you could compile with > -mfpmath=sse > > >> Technically this code path is *not* using floating point at all (by >> JPEG 2000 reversible kernel design). integer based shift&additions >> operations only. > > Then I suggest compiling with -fsanitize=undefined to see if there are > any undefined shifts. [...] /home/mathieu/tmp/opj-bug/openjpeg/src/lib/openjp2/t1.c:1517:28: runtime error: left shift of negative value -128 [...] You've saved me hours of time ! Thanks. for reference: https://github.com/uclouvain/openjpeg/blob/master/src/lib/openjp2/t1.c#L1517