[C++ PATCH] RFC: implement P0386R2 - C++17 inline variables

Jakub Jelinek jakub@redhat.com
Tue Oct 25 18:06:00 GMT 2016


On Tue, Oct 25, 2016 at 04:05:30PM +0100, Andre Vieira (lists) wrote:
> I built gcc for the following:
> 1) revision r241135
> 2) revision r241135  + cherry-picked your patch in revision r241137
> (skipped the patch in revision r241136 because that gives a build failure).
> 3) trunk + patch in http://gcc.gnu.org/ml/gcc-patches/2016-10/msg01183.html
> 
> And compiling the member-ptr.cc file in the gdb testsuite without
> -std=c17 (see
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/testsuite/gdb.cp/member-ptr.cc;h=4b7da34d3a77e3b5c045bd76d1f0a01514a039d7;hb=HEAD)
> leads to the following behavior:
> 
> 1) expected behavior, debug of information of objects of 'class A' looks
> fine.
> 2) new debug information for objects of 'class A' breaking the test.
> 3) same as 2)
> 
> As you can see the file has no explicit inline vars and I do not compile
> it with -std=c++17.
> 
> So I'm suspecting your patch changes this behavior in an unexpected way.

I think this patch should fix it, will bootstrap/regtest it now:

2016-10-25  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (gen_member_die): Only reparent_child instead of
	splice_child_die if child doesn't have DW_AT_specification attribute.

--- gcc/dwarf2out.c.jj	2016-10-25 19:49:28.000000000 +0200
+++ gcc/dwarf2out.c	2016-10-25 20:02:33.264639847 +0200
@@ -22624,7 +22624,8 @@ gen_member_die (tree type, dw_die_ref co
 	  /* Handle inline static data members, which only have in-class
 	     declarations.  */
 	  if (child->die_tag == DW_TAG_variable
-	      && child->die_parent == comp_unit_die ())
+	      && child->die_parent == comp_unit_die ()
+	      && get_AT (child, DW_AT_specification) == NULL)
 	    {
 	      reparent_child (child, context_die);
 	      child->die_tag = DW_TAG_member;


	Jakub



More information about the Gcc-patches mailing list