From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4075 invoked by alias); 11 Jul 2002 21:06:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3956 invoked by uid 71); 11 Jul 2002 21:06:02 -0000 Date: Thu, 11 Jul 2002 14:06:00 -0000 Message-ID: <20020711210602.3953.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Jason Merrill Subject: Re: optimization/7247: copy constructor missing when inlining enabled for i386 Reply-To: Jason Merrill X-SW-Source: 2002-07/txt/msg00353.txt.bz2 List-Id: The following reply was made to PR optimization/7247; it has been noted by GNATS. From: Jason Merrill To: "H. J. Lu" Cc: gawrilow@math.tu-berlin.de, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: optimization/7247: copy constructor missing when inlining enabled for i386 Date: Thu, 11 Jul 2002 22:02:12 +0100 >>>>> "H" == H J Lu writes: > Jason, it looks like your patch doesn't catch this one. No, as the bug isn't related to the NRVO; this testcase doesn't have any returns which would be affected. Rather, it seems to be a dependency tracking bug. I can reproduce the bug by adding 'inline' to the definition of incidence_matrix and compiling with -O -fschedule-insns2. Without -fschedule-insns2, the code leading up to the dump_op calls looks like movl -96(%ebp), %eax movl -92(%ebp), %edx movl %eax, -52(%ebp) movl %edx, -48(%ebp) leal -96(%ebp), %eax movl %eax, (%esp) call pm::dump_op(pm::double_zero const&) leal -52(%ebp), %eax movl %eax, (%esp) call pm::dump_op(pm::double_zero const&) so the epsilon value is properly copied before it is dumped. But with scheduling, it looks like movl -96(%ebp), %eax movl %eax, -52(%ebp) leal -96(%ebp), %eax movl %eax, (%esp) call pm::dump_op(pm::double_zero const&) leal -52(%ebp), %eax movl %eax, (%esp) call pm::dump_op(pm::double_zero const&) Which suggests that the scheduler incorrectly decides that the second word wasn't used by the call and optimizes away the copy. This bug, or a similar one, seems still to be present in the trunk, though to see it you also need to move the definition of the double_zero constructor outside the class, so it is not inlined. Jason