[Bug c++/19199] [3.3/3.4 Regression] Wrong warning about returning a reference to a temporary

roger at eyesopen dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 5 23:14:00 GMT 2005


------- Additional Comments From roger at eyesopen dot com  2005-04-05 23:13 -------
Now that a fix has been applied to both mainline and the 4.0 branch, I've been
investigating backporting the fix to 3.4.  Unfortunately, a significant feature
of the fixes proposed by Alex and me are that they disable the problematic
transformations during parsing, but allow them to be caught by later tree-ssa
passes.  Unfortunately, in gcc 3.4.x if we disable constant folding of
COND_EXPRs for C++, there are no tree-level optimizers that can take up the
slack, and instead we'd rely on if-conversion to do what it can at the RTL
level. I'm not convinced that 3.4 if-conversion is particularly effective in
this respect (certainly across all targets), and I've not yet checked whether
all of the affected transformations are implementated in ifcvt.c (even on
mainline).

Might I propose that we close this bug as won't fix for both the 3.3 and 3.4
branches.  GCC has always generated wrong code for this case, and the current
state of 3.4.4 is that we issue an incorrect warning (which seems better than
silently generating wrong code as we did with 3.1).  It's a trade-off; but I'm
keen to avoid degrading g++ 3.4.5 (in the common case), for a diagnostic
regression.  Or we could leave the PR open (and perhaps unassign it) in the
hope that a 3.4 solution will be discovered, as the mainline/4.x fixes aren't
suitable.  Mark?  Alexandre?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 4.0.0 3.3.2           |3.4.0 3.3.2
      Known to work|                            |4.0.0 4.1.0
            Summary|[3.3/3.4/4.0 Regression]    |[3.3/3.4 Regression] Wrong
                   |Wrong warning about         |warning about returning a
                   |returning a reference to a  |reference to a temporary
                   |temporary                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19199



More information about the Gcc-bugs mailing list