$ gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.4.0_pre9999/work/gcc-4.4.0-9999/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.0-pre9999 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-pre9999/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-pre9999 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-pre9999/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.0-pre9999/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.0-pre9999/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --disable-libgomp --enable-cld --disable-libgcj --with-arch=i686 --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion= Thread model: posix gcc version 4.4.0-pre9999 built 20090310 (Gentoo SVN ebuild) rev. 144732 ()
The command to trigger the bug: gcc prdtoa.i -g -c -O2 The symptom of the bug: In the output of objdump -S -l prdtoa.o /tmp/prdtoa.c:1837 #endif /* rv = */ rounded_product(dval(rv), tens[e]); goto ret; #endif } i = DBL_DIG - nd; These 6 lines of code only generate one instruction 25de: ba 25 00 00 00 mov $0x25,%edx If use gcc 4.3.3, the output is like this: /tmp/prdtoa.c:1833 if (sign) { rv = -rv; sign = 0; } #endif /* rv = */ rounded_product(dval(rv), tens[e]); 284e: 8b 5d 90 mov -0x70(%ebp),%ebx 2851: dd 45 d0 fldl -0x30(%ebp) 2854: dc 0c dd e0 00 00 00 fmull 0xe0(,%ebx,8) 285b: 8b 5d 98 mov -0x68(%ebp),%ebx 285e: e9 cd fd ff ff jmp 2630 <PR_strtod+0x210> 2863: 90 nop 2864: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi The impact of this bug: prdtoa.c is from NSPR, NetScape Portable Runtime, which is used by firefox. This bug will cause font size of certain tags become extremely large because of the abnormal behavior of function PR_strtod. For example, given "1.5" as a parameter, PR_strtod will return 15.0. I found this when trying firefox on N32 ABI Loongson system. Since Loongson specific support only avaiable in gcc 4.4. Will post the prdtoa.i soon. -- Summary: [4.4 Regression] code mistakenly optimized out when -O2 is enabled Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: r0bertz at gentoo dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39418