diff mbox

[trans-mem,c++] PR51928

Message ID 4F1DFCB0.7050701@gmail.com
State New
Headers show

Commit Message

Patrick Marlier Jan. 24, 2012, 12:34 a.m. UTC
Hi,

In this PR51928, it tries to look_for_tm_attr_overrides on a thunk but 
there is no DECL_NAME for thunk. So it fails in 
lookup_fnfields_idx_nolazy because name is NULL.

#0  0x0000000000764b5a in lookup_fnfields_idx_nolazy 
(type=0x7ffff69f77e0, name=0x0) at ../../trunk/gcc/cp/search.c:1384
#1  0x000000000076551a in lookup_fnfields_1 (type=0x7ffff69f77e0, 
name=0x0) at ../../trunk/gcc/cp/search.c:1470
#2  0x000000000076886e in look_for_overrides_here (type=0x7ffff69f77e0, 
fndecl=0x7ffff69f8800) at ../../trunk/gcc/cp/search.c:2026
#3  0x0000000000635a94 in look_for_tm_attr_overrides 
(type=0x7ffff6a091f8, fndecl=0x7ffff69f8800) at 
../../trunk/gcc/cp/class.c:4337

I hope the good way to solve this is to use the THUNK_TARGET instead of 
the thunk itself. (or just ignore when it is a thunk?)

Tested on x86_64-unknown-linux-gnu.
Thanks.
--
Patrick Marlier.
Changelog

2012-01-23  Patrick Marlier  <patrick.marlier@gmail.com>

	PR c++/51928
	* cp/class.c (set_method_tm_attributes): Use TARGET_THUNK instead of
	thunk for set_one_vmethod_tm_attributes.

testsuite/Changelog

2012-01-23  Patrick Marlier  <patrick.marlier@gmail.com>

	PR c++/51928
	* g++.dg/tm/pr51928.C: New test.

Comments

Jason Merrill Jan. 24, 2012, 2:13 a.m. UTC | #1
OK.

Jason
Aldy Hernandez Jan. 24, 2012, 1:32 p.m. UTC | #2
On 01/23/12 18:34, Patrick Marlier wrote:
> Hi,
>
> In this PR51928, it tries to look_for_tm_attr_overrides on a thunk but
> there is no DECL_NAME for thunk. So it fails in
> lookup_fnfields_idx_nolazy because name is NULL.
>
> #0 0x0000000000764b5a in lookup_fnfields_idx_nolazy
> (type=0x7ffff69f77e0, name=0x0) at ../../trunk/gcc/cp/search.c:1384
> #1 0x000000000076551a in lookup_fnfields_1 (type=0x7ffff69f77e0,
> name=0x0) at ../../trunk/gcc/cp/search.c:1470
> #2 0x000000000076886e in look_for_overrides_here (type=0x7ffff69f77e0,
> fndecl=0x7ffff69f8800) at ../../trunk/gcc/cp/search.c:2026
> #3 0x0000000000635a94 in look_for_tm_attr_overrides
> (type=0x7ffff6a091f8, fndecl=0x7ffff69f8800) at
> ../../trunk/gcc/cp/class.c:4337
>
> I hope the good way to solve this is to use the THUNK_TARGET instead of
> the thunk itself. (or just ignore when it is a thunk?)
>
> Tested on x86_64-unknown-linux-gnu.
> Thanks.
> --
> Patrick Marlier.

I can commit for you, but the testcase is missing, though the changelog 
entry for it is there.
diff mbox

Patch

Index: cp/class.c
===================================================================
--- cp/class.c	(revision 183448)
+++ cp/class.c	(working copy)
@@ -4430,7 +4430,12 @@  set_method_tm_attributes (tree t)
       tree vchain;
       for (vchain = BINFO_VIRTUALS (TYPE_BINFO (t)); vchain;
 	   vchain = TREE_CHAIN (vchain))
-	set_one_vmethod_tm_attributes (t, BV_FN (vchain));
+	{
+	  fndecl = BV_FN (vchain);
+	  if (DECL_THUNK_P (fndecl))
+	    fndecl = THUNK_TARGET (fndecl);
+	  set_one_vmethod_tm_attributes (t, fndecl);
+	}
     }
 
   /* If the class doesn't have an attribute, nothing more to do.  */