Of the flags that -ffast-math sets, turning -ffinite-math-only off again avoids the erroneous optimization. With the attached patch, libvorbis's examples/encoder_example produces the same (correct) output as on arm-oldabi and it makes oggenc work on armel too.
M
On armel, oggenc creates short output files that decode to the correct amount of silence. This is caused by an optimization bug present in gcc 4.[123] that miscompiles the MAX(x,y) macro, optimizing it away completely. Fixes: http://bugs.debian.org/515949 Analysis: https://trac.xiph.org/ticket/1526 Martin Guy <martinw...@yahoo.it> March 2009 --- libvorbis-1.2.0.dfsg/configure.in.old 2007-07-25 17:27:00.000000000 +0100 +++ libvorbis-1.2.0.dfsg/configure.in 2009-03-19 07:44:38.000000000 +0000 @@ -168,6 +168,12 @@ CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; esac + + # Avoid an optimization bug in gcc-4.[123] + case $host in + arm*-*-linux-gnueabi) + CFLAGS+=" -fno-finite-math-only" ;; + esac fi CFLAGS="$CFLAGS $cflags_save" --- libvorbis-1.2.0.dfsg/configure.old 2007-07-25 17:46:37.000000000 +0100 +++ libvorbis-1.2.0.dfsg/configure 2009-03-19 07:45:54.000000000 +0000 @@ -19484,6 +19484,12 @@ CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; esac + + # Avoid an optimization bug in gcc-4.[123] + case $host in + arm*-*-linux-gnueabi) + CFLAGS+=" -fno-finite-math-only" ;; + esac fi CFLAGS="$CFLAGS $cflags_save"