Well done narrowing the issue down. I haven't had the chance to compare the assembly output yet, but does it work if you compile with -fno-aggressive-loop-optimizations? Ref: http://postgresql.1045698.n5.nabble.com/Back-branches-vs-gcc-4-8-0-td5750997.html
- Alexander / xyproto