c++/1833

aoliva@gcc.gnu.org aoliva@gcc.gnu.org
Sun Apr 1 00:00:00 GMT 2001


The following reply was made to PR c++/1833; it has been noted by GNATS.

From: aoliva@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, peteb@sitera.com
Cc:  
Subject: Re: c++/1833
Date: 2 Mar 2001 10:26:28 -0000

 Synopsis: inlining sometimes causes incorrect behavior
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: aoliva
 State-Changed-When: Fri Mar  2 02:26:28 2001
 State-Changed-Why:
     There is indeed a bug.  The problem is that the result of the cast is an rvalue, because the cast-to type is not a reference type.  Therefore, a temporary should be created.  However, a temporary cannot be bound to a non-const reference, but g++ happily binds it to frob2's argument, even with -ansi -pedantic.
     Even if the binding-to-non-const were to be done as an extension, it still shouldn't modify variable s; it should modify the temporary, then discard it.
     WRT the difference between the inline and the non-inline functions, the problem is likely to be in the tree level, because the initial RTL dump is already significantly different for the two functions.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1833&database=gcc



More information about the Gcc-prs mailing list