------- Comment #4 from jakub at gcc dot gnu dot org 2006-06-21 12:20 -------
This sounds like a tree-nrv bug to me.
We have at *.optimized:
QTime QTime::msToTime() (this)
{
struct QTimeD.1732 D.1772;
struct QTimeD.1732 tD.1765;
(voidD.34) 0;
D.1772 = addMSecs (&<retval>);
<retval> = D.1772;
return <retval>;
}
(note D.1772 never has address taken, while <retval> does).
Now tree_nrv () finds <retval> is only set to D.1772 and:
/* At this point we know that all the return statements return the
same local which has suitable attributes for NRV. Copy debugging
information from FOUND to RESULT. */
DECL_NAME (result) = DECL_NAME (found);
DECL_SOURCE_LOCATION (result) = DECL_SOURCE_LOCATION (found);
DECL_ABSTRACT_ORIGIN (result) = DECL_ABSTRACT_ORIGIN (found);
TREE_ADDRESSABLE (result) = TREE_ADDRESSABLE (found);
which clears the addressable flag, although the RESULT_DECL clearly has its
address taken. Perhaps the last line should be:
TREE_ADDRESSABLE (result) |= TREE_ADDRESSABLE (found);
but am not 100% sure if tree_nrv is a safe transformation if TREE_ADDRESSABLE
(result) was set already. Also, in this case DECL_NAME (result) contained the
real var name (t) while DECL_NAME (found) is NULL, so perhaps the first 3 lines
should be conditionalized on if (DECL_NAME (found)) to avoid making debug info
worse.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dnovillo at redhat dot com,
| |law at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-06-21 12:20:43
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28116