Revision 161654 compiles the attached test-case correctly at -O2. Revision 161655 does not (except at -O0).
I guess the bug is apparent for other targets too, but I haven't checked. Note for cris-elf this bb, correctly compiled (path for *s = '0' to sf return): .L7: move.b 48,$r13 move.b $r13,[$r11] addq 1,$r13 ret move.b $r13,[$r9] and incorrectly: .L7: move.b 48,$r9 move.b $r9,[$r10-1] addq 10,$r9 move.b $r9,[$r10-1] ret nop (storing '0' and then adding 10 to it, making ':') The test-case is distilled from newlib/libc/stdlib/dtoa.c, where the bug causes a store of ':' directly, without bothering to first store '0' :) but apparently the same bug. The miscompilation is exposed as regressions in three fortran test-cases from r161655 and on, up to and including at least r161893: Running /tmp/regress-0630-55/gcc/gcc/testsuite/gfortran.dg/dg.exp ... ... (non-regressions elided) FAIL: gfortran.dg/edit_real_1.f90 -O0 execution test FAIL: gfortran.dg/edit_real_1.f90 -O1 execution test FAIL: gfortran.dg/edit_real_1.f90 -O2 execution test FAIL: gfortran.dg/edit_real_1.f90 -O3 -fomit-frame-pointer execution test FAIL: gfortran.dg/edit_real_1.f90 -O3 -fomit-frame-pointer -funroll-loops execution test FAIL: gfortran.dg/edit_real_1.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test FAIL: gfortran.dg/edit_real_1.f90 -O3 -g execution test FAIL: gfortran.dg/edit_real_1.f90 -Os execution test FAIL: gfortran.dg/fmt_float.f90 -O0 output pattern test, is 0.10E+01 0.10E+00 0.:0E\ (...verbosity elided but note the ":"; there's a "1" expected there) FAIL: gfortran.dg/fmt_float.f90 -O1 output pattern test, is 0.10E+01 0.10E+00 0.:0E\ (...further similar fmt_float results elided) FAIL: gfortran.dg/fmt_zero_precision.f90 -O0 output pattern test, is 1.< (...verbosity elided) FAIL: gfortran.dg/fmt_zero_precision.f90 -O1 output pattern test, is 1.< (...further similar fmt_zero_precision results elided) -- Summary: [4.6 Regression]: miscompilation of newlib dtoa.c after mem-ref2 merge Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hp at gcc dot gnu dot org GCC host triplet: x86_64-linux GCC target triplet: cris-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44852