using the gcc-3.3.1-20030720 prerelease, binutils-2.4 the following code ---- #include <iostream> void foo(float f); void split1() { std::cout << .1f ; foo(.1f); } --- causes: > /dept/rnd/vendor/gcc-3.3.1-20030720/bin/g++ -fnon-call-exceptions -O2 -c asmbug.C -o /dev/null /usr/tmp/cchhQIen.s: Assembler messages: /usr/tmp/cchhQIen.s:25: Error: junk `.00000001490116119384766e-1' after expression /usr/tmp/cchhQIen.s:25: Error: too many memory references for `mov' the assembly generated for split1 is: --- .globl _Z6split1v .type _Z6split1v, @function _Z6split1v: .LFB1607: pushl %ebp .LCFI0: movl %esp, %ebp .LCFI1: subl $24, %esp .LCFI2: flds .LC1 movl $_ZSt4cout, (%esp) fstpl 4(%esp) call _ZNSolsEd movl 1.00000001490116119384766e-1, (%esp) call _Z3foof movl %ebp, %esp popl %ebp ret --- I'll attach preprocessed source and resulting assembly to the bug. -nick
Created attachment 4456 [details] preprocessed source triggering bug
Created attachment 4457 [details] resulting assembly from the compiler
This looks like a bad regression I can reproduce it on the mainline (20030719) and 3.3.1 (20030707). I think the problem is only when printing out the floating point number. There might be a way to construct a testcase which does not use -fnon-call-exceptions.
Created attachment 4458 [details] better testcase with no iostream dependancy
Created attachment 4459 [details] assembly output from better testcase
The simplified example does not show the problem on the mainline (20030719) but it does show the problem in 3.3.1 (20030707).
The regression in PR 11637 was introduced or exposed with this patch: --- gcc/gcc/ChangeLog --- 2002-11-17 Graham Stott <graham.stott@btinternet.com> * real.c (real_to_decimal): Fix buffer overrun when buffer size is smaller than representation. It is still broken on the 3.3-branch but was fixed on mainline by: --- gcc/gcc/ChangeLog --- Tue Jan 14 00:45:33 CET 2003 Jan Hubicka <jh@suse.cz> * convert.c (strip_float_extensions): Look for narrowest type handling FP constants. * fold-const.c (fold): Fold (double)float1 CMP (double)float2 into float1 CMP float2. * convert.c (strip_float_extensions): Make global. * tree.h (strip_float_extensions): Declare. The regression hunt was done on i686-pc-linux-gnu using the small test case compiled with "-O2 -fnon-call-exceptions, and then searching the generated .s file for "3e-2".
Postponed until GCC 3.3.2.
Fixing.
Diagnostic: http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00872.html Patch: http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01246.html
Subject: Re: [3.3/3.4 Regression]g++ invalid assembly with -fnon-call-exceptions On Fri, 2003-10-03 at 23:17, ebotcazou at gcc dot gnu dot org wrote: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11637 This patch is OK, with one caveat: I don't understand why it's necessary to remove REG_NOALIAS notes. If that's not necessary to fix the test case in question, please omit that one part of the patch. If it is necessary, go ahead and check in the patch, but please explain what's going wrong there. (The docs say that REG_NOALIAS is attached to call instructions, and here I thought we were always looking a SET.) Thanks,
You're right, removing REG_NOALIAS notes is not necessary. I included it because the first version of the patch (which was messy) tweaked distribute_notes instead, and distribute_notes treats the 3 kinds of notes the same way. I'll remove it. Thanks for the review.
Subject: Bug 11637 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2003-10-06 08:52:23 Modified files: gcc : ChangeLog combine.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: float1.C Log message: 2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr> PR optimization/11637 * combine.c (adjust_for_new_dest): New function to adjust the notes and LOG_LINKS when the dest of an insn has changed. (try_combine): Use it when deleting the first insn of a two-insn parallel or splitting a two-load parallel. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1296&r2=2.1297 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&r1=1.389&r2=1.390 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3096&r2=1.3097 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/float1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 11637 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: ebotcazou@gcc.gnu.org 2003-10-06 08:59:02 Modified files: gcc : ChangeLog combine.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: float1.C Log message: PR optimization/11637 * combine.c (adjust_for_new_dest): New function to adjust the notes and LOG_LINKS when the dest of an insn has changed. (try_combine): Use it when deleting the first insn of a two-insn parallel or splitting a two-load parallel. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.771&r2=1.16114.2.772 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.325.2.13&r2=1.325.2.14 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.297&r2=1.2261.2.298 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/float1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Patch applied with Mark's correction.