public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mueller at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/19317] New: forgets to deep-copy temporary return value
Date: Fri, 07 Jan 2005 19:15:00 -0000	[thread overview]
Message-ID: <20050107191510.19317.mueller@kde.org> (raw)

Mark Mitchel's commit to fix PR c++/16405 introduced a miscompilation 
in Qt. It took me a few weeks to deduce a testcase. testcase is: 
 
=== Cut === 
extern "C" void abort( void ); 
 
struct A 
{ 
    A() { d = d2 = 0; width = -1; } 
    A( int _w ) : d( 0 ), d2( 0 ), width( _w ) {} 
 
    A  b( const A &r ) const; 
    int d; 
    int d2; 
    int width; 
}; 
 
A A::b( const A &r ) const 
{ 
    A tmp; 
    tmp.width = width < r.width ? width : r.width; 
    return tmp; 
} 
 
int main() 
{ 
        A a( 100 ); 
        a = a.b( A( 10 ) ); 
        if ( a.width != 10 ) 
               abort(); 
} 
=== Cut === 
 
The issue is that the result of "a.b(A (10))" is never copied to a, hence 
the if() afterwards fails.

-- 
           Summary: forgets to deep-copy temporary return value
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mueller at kde dot org
                CC: gcc-bugs at gcc dot gnu dot org,mark at codesourcery dot
                    com
 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=19317


             reply	other threads:[~2005-01-07 19:15 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07 19:15 mueller at kde dot org [this message]
2005-01-07 19:16 ` [Bug c++/19317] " mueller at kde dot org
2005-01-07 19:16 ` [Bug c++/19317] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-01-07 19:26 ` pinskia at gcc dot gnu dot org
2005-01-07 19:30 ` [Bug c++/19317] [4.0 Regression] removing a temporary return value when we cannot pinskia at gcc dot gnu dot org
2005-01-10  4:52 ` pinskia at gcc dot gnu dot org
2005-01-10  5:03 ` pinskia at gcc dot gnu dot org
2005-01-15 12:45 ` steven at gcc dot gnu dot org
2005-01-24 13:27 ` pinskia at gcc dot gnu dot org
2005-02-13 21:24 ` mueller at kde dot org
2005-02-13 21:31 ` pinskia at gcc dot gnu dot org
2005-02-16  6:51 ` mueller at kde dot org
2005-03-10 23:49 ` [Bug c++/19317] [4.0/4.1 " pluto at pld-linux dot org
2005-03-17 17:33 ` mueller at kde dot org
2005-03-17 18:22 ` pluto at pld-linux dot org
2005-03-18  0:34 ` jason at redhat dot com
2005-03-24 11:07 ` pluto at pld-linux dot org
2005-03-24 12:46 ` rwgk at yahoo dot com
2005-03-24 21:04 ` pinskia at gcc dot gnu dot org
2005-04-05  6:25 ` mmitchel at gcc dot gnu dot org
2005-04-05 23:14 ` cvs-commit at gcc dot gnu dot org
2005-04-07 21:01 ` [Bug c++/19317] [4.1 " pinskia at gcc dot gnu dot org
2005-04-08 13:33 ` pluto at pld-linux dot org
2005-04-09  2:29 ` pluto at pld-linux dot org
2005-04-11  7:49 ` jason at redhat dot com
2005-04-11  9:00 ` pluto at pld-linux dot org
2005-04-11 12:48 ` jason at redhat dot com
2005-04-11 14:44 ` pluto at pld-linux dot org
2005-04-12 10:27 ` mueller at kde dot org
2005-04-12 20:01 ` mlists at juma dot me dot uk
2005-04-13  1:10 ` mueller at kde dot org
2005-04-13  1:36 ` mueller at kde dot org
2005-04-13 16:57 ` mueller at kde dot org
2005-05-17  5:41 ` bernie at develer dot com
2005-05-18 19:38 ` jason at gcc dot gnu dot org
2005-05-18 20:45 ` bernie at develer dot com
2005-05-18 21:18 ` jason at redhat dot com
2005-05-19  9:04 ` pluto at agmk dot net
2005-05-19  9:45 ` bernie at develer dot com
2005-05-19 10:42 ` bernie at develer dot com
2005-06-23 14:44 ` cvs-commit at gcc dot gnu dot org
2005-06-24 14:11 ` pinskia at gcc dot gnu dot org
2005-07-08 14:13 ` cvs-commit at gcc dot gnu dot org
2005-09-26 23:18 ` kev dot gilbert at cdu dot edu dot au
2005-09-27  0:44 ` bangerth at dealii dot org
2005-09-27  7:28 ` kev dot gilbert at cdu dot edu dot au
2005-09-27 14:01 ` bangerth at dealii dot org
2005-09-30  1:59 ` kev dot gilbert at cdu dot edu dot au

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050107191510.19317.mueller@kde.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).