[Bug c++/89001] g++ uses wrong mangling for lifetime-extended temporaries

2019-01-24 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |9.0

--- Comment #5 from Jason Merrill  ---
Fixed for GCC 9.

[Bug c++/89001] g++ uses wrong mangling for lifetime-extended temporaries

2019-01-24 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001

--- Comment #4 from Jason Merrill  ---
Author: jason
Date: Thu Jan 24 21:23:33 2019
New Revision: 268252

URL: https://gcc.gnu.org/viewcvs?rev=268252=gcc=rev
Log:
PR c++/89001 - mangling of reference temporaries

It used to be the case that the mangled name of a reference temporary didn't
need to be standardized, because all access would be through the reference.
But now constant expressions can look through references and so different
translation units need to agree on the address of a temporary in the
initializer of a reference with vague linkage.

* cp-tree.h (struct saved_scope): Add ref_temp_count.
(current_ref_temp_count): New macro.
* mangle.c (mangle_ref_init_variable): Use it.
* typeck2.c (store_init_value): Clear it.
* call.c (make_temporary_var_for_ref_to_temp): Copy public and
comdat.

Added:
trunk/gcc/testsuite/g++.dg/abi/ref-temp1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/mangle.c
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/g++.dg/cpp1z/decomp34.C

[Bug c++/89001] g++ uses wrong mangling for lifetime-extended temporaries

2019-01-24 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/89001] g++ uses wrong mangling for lifetime-extended temporaries

2019-01-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001

--- Comment #3 from Jakub Jelinek  ---
So do we need a GTY hash table mapping VAR_DECLs to lifetime-extended temporary
count and use that during the mangling?

[Bug c++/89001] g++ uses wrong mangling for lifetime-extended temporaries

2019-01-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001

--- Comment #2 from Jakub Jelinek  ---
  start_mangling (variable);
  write_string ("_ZGR");
  check_abi_tags (variable);
  write_name (variable, /*ignore_local_scope=*/0);
  /* Avoid name clashes with aggregate initialization of multiple
 references at once.  */
  write_unsigned_number (temp_count++);
  return finish_mangling_get_identifier ();

So, the number we append is unique to the whole TU, rather than specific to a
particular lifetime-extended temporary.  So, we'd need to do more than just
change that write_unsigned_number call to write_compact_number.

[Bug c++/89001] g++ uses wrong mangling for lifetime-extended temporaries

2019-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89001

Richard Biener  changed:

   What|Removed |Added

   Keywords||ABI
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-01-23
Version|unknown |9.0
 Ever confirmed|0   |1
  Known to fail||7.3.1, 8.2.1, 9.0

--- Comment #1 from Richard Biener  ---
GCC behaves like this since the feature is supported.