Bug#800321: gcc-5: [mips64el] miscompilation caused by -fexpensive-optimizations
control: forwarded -1 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67736
On 2015-09-27 21:02, Andreas Cadhalpun wrote:
> Package: gcc-5
> Version: 5.2.1-17
> Severity: important
> Control: affects -1 ffmpeg
> X-Debbugs-Cc: debian-mips@lists.debian.org
>
>
> Dear Maintainer,
>
> ffmpeg 7:2.8-1 failed to build on mips64el due to a test failure.
>
> I investigated the problem and it turns out to be caused by a compiler bug
> that can be avoided by using '-fno-expensive-optimizations'.
>
> Attached is a reduced test case:
> $ ls
> Makefile main.c test.c
> $ make
> cc -fPIC -O2 -fno-expensive-optimizations -c -o working.o test.c
> cc -shared -o libworking.so working.o
> cc -o working main.c -L. -lworking
> cc -fPIC -O2 -c -o broken.o test.c
> cc -shared -o libbroken.so broken.o
> cc -o broken main.c -L. -lbroken
> LD_LIBRARY_PATH=. ./working || true
> A f00000100 101
> B f00000100 101
> working
> LD_LIBRARY_PATH=. ./broken || true
> A f00000100 101
> broken
>
> In the broken version the '& 0xFFFFFFFF' in following line gets ignored:
> if (*last == ((state | buf) & 0xFFFFFFFF))
>
> This also fails with gcc-4.9 and gcc-4.8, so it is a longstanding problem.
Thanks for the detailed test case. I have just reported the bug
upstream, I hope someone will come with a fix soon.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
Reply to: