public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19317] New: forgets to deep-copy temporary return value
@ 2005-01-07 19:15 mueller at kde dot org
  2005-01-07 19:16 ` [Bug c++/19317] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (46 more replies)
  0 siblings, 47 replies; 50+ messages in thread
From: mueller at kde dot org @ 2005-01-07 19:15 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 50+ messages in thread
[parent not found: <bug-19317-3563@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2005-12-08 21:56 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07 19:15 [Bug c++/19317] New: forgets to deep-copy temporary return value 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:16 ` [Bug c++/19317] " mueller at kde dot org
2005-01-07 19:26 ` [Bug c++/19317] [4.0 Regression] " 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
     [not found] <bug-19317-3563@http.gcc.gnu.org/bugzilla/>
2005-12-08 21:50 ` jakub at gcc dot gnu dot org
2005-12-08 21:56 ` jakub at gcc dot gnu dot org

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).