This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/70760] [6/7 regression] wrong generated code for std::make_unique with -fipa-pta
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 27 Apr 2016 13:11:46 +0000
- Subject: [Bug ipa/70760] [6/7 regression] wrong generated code for std::make_unique with -fipa-pta
- Auto-submitted: auto-generated
- References: <bug-70760-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70760
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|6.2 |6.0
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the underlying issue is that
/* If we pass the result decl by reference, honor that. */
if (lhsop
&& fndecl
&& DECL_RESULT (fndecl)
&& DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
{
for the call
D.941390 =
std::_ZSt11make_uniqueIN3edm20ParameterDescriptionIiEEJRA16_KcRKiRbEENSt9_MakeUniqIT_E15__single_objectEDpOT0_.isra.144
("p_int_untracked", &D.481115, 0); [return slot optimization]
runs into a NULL_TREE DECL_RESULT (fndecl) because that has been freed as
the decl is only an alias:
_ZSt11make_uniqueIN3edm20ParameterDescriptionIiEEJRA16_KcRKiRbEENSt9_MakeUniqIT_E15__single_objectEDpOT0_.isra.144/21428
(typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...)
[with _Tp = edm::ParameterDescription<int>; _Args = {const char (&)[16], const
int&, bool&}]) @0x7ffff4d17450
Type: function definition analyzed alias
Visibility: prevailing_def_ironly artificial
References:
_ZSt11make_uniqueIN3edm20ParameterDescriptionIiEEJRA6_KcRKiRbEENSt9_MakeUniqIT_E15__single_objectEDpOT0_.isra.149/21451
(alias)
Referring:
Availability: local
First run: 0
Function flags: local icf_merged
Called by:
_ZN7edmtest20ProducerWithPSetDesc16fillDescriptionsERN3edm25ConfigurationDescriptionsE/5911
(1.00 per call)
Calls:
so we fail to resolve the decl to the alias target. The following would fix
that
Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c (revision 235404)
+++ gcc/tree-ssa-structalias.c (working copy)
@@ -4658,9 +4658,8 @@ find_func_aliases_for_call (struct funct
/* If we pass the result decl by reference, honor that. */
if (lhsop
- && fndecl
- && DECL_RESULT (fndecl)
- && DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
+ && fi->is_fn_info
+ && DECL_BY_REFERENCE (DECL_RESULT (fi->decl)))
{
struct constraint_expr lhs;
struct constraint_expr *rhsp;
but it still won't handle indirect calls correctly which is what the 3rd
patch does. It still might be that I'm going with sth like the above for
the GCC 6 branch.