Package: gcc-4.9 Version: 4.9.1-19 Severity: normal I have a minimal reproducable test case in a git repo here:
https://github.com/erikd/gcc-aarch64-optimization-bug which contails a test program which passes when run with optimization flags "-O1" and fails with "-O1 -fschedule-insns". Cloning that repo under aarch64 and doing: CC=gcc-4.9 make clean check compiles and runs the program with both sets of optimization flags and displays success or failure. It does not hwoever fail on aarch64 with gcc-4.8 or with gcc-snapshot, nor does it fail with any version of GCC on any other architecture. There is a usefule comment from Måns Rullgård on G+: https://plus.google.com/u/0/+ErikdeCastroLopo/posts/F2BPxT7g1Gx OK, it's a gcc bug. For some unfathomable reason, it chooses to calculate "mask = ~0u >> (32 - numBits)" in a vector register by means of left-shifting by -(32 - numBits). It then subtracts (bitPos & 7) from the negated value and uses this as the shift amount of a regular shift instruction in "mask <<= shift" which is obviously nonsense. This behaviour (and the bug) was introduced in rev 202020 (git 5674183), and reverting this commit makes things work again. I believe the -fschedule-insns flag is a red herring. It probably merely stirs up the code in a way that makes the real bug trigger. Older discussion about this problem here: https://plus.google.com/u/0/+ThomasRuecker/posts/e9uxoUyk3Bk -- System Information: Debian Release: 8.0 APT prefers unstable APT policy: (500, 'unstable') Architecture: arm64 (aarch64) Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_AU.UTF-8) Shell: /bin/sh linked to /bin/dash Init: unable to detect Versions of packages gcc-4.9 depends on: ii binutils 2.24.90.20141201-1 ii cpp-4.9 4.9.2-5 ii gcc-4.9-base 4.9.2-5 ii libc6 2.19-13 ii libcloog-isl4 0.18.2-1+b2 ii libgcc-4.9-dev 4.9.2-5 ii libgmp10 2:6.0.0+dfsg-6 ii libisl10 0.12.2-2+b2 ii libmpc3 1.0.2-1+b2 ii libmpfr4 3.1.2-1+b2 ii zlib1g 1:1.2.8.dfsg-2+b1 Versions of packages gcc-4.9 recommends: ii libc6-dev 2.19-13 Versions of packages gcc-4.9 suggests: pn gcc-4.9-doc <none> pn gcc-4.9-locales <none> pn libasan1-dbg <none> pn libatomic1-dbg <none> pn libcilkrts5-dbg <none> pn libgcc1-dbg <none> pn libgomp1-dbg <none> pn libitm1-dbg <none> pn liblsan0-dbg <none> pn libquadmath-dbg <none> pn libtsan0-dbg <none> pn libubsan0-dbg <none> -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org