[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-10 Thread patrick.marlier at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #12 from Patrick Marlier patrick.marlier at gmail dot com 
2011-03-10 14:19:35 UTC ---
On 03/10/2011 12:01 AM, rth at gcc dot gnu.org wrote:
 I suspect, but have not yet verified, that this is related to
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
// NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE  0
extern template class basic_stringchar;

 in that we're copying the is extern bit, which is not true for
 the transactional clone.

I don't know if it is related but I have another bug which may be 
related with template.

In a relaxed transaction, some functions (stl? template?) in a 
transaction doesn't call the clone version (nor call to 
ITM_changeTransactionMode).
You can verify this in the function stepDestroyBuildings 
(_ZL20stepDestroyBuildingsi) in src/Tean.cpp, the function 
_ZNSt4listIP8BuildingSaIS1_EE5beginEv is called directly (not the clone, 
no irrevocable mode) even if in a transaction.

I had a quick look and the clone function exists but seems not be 
replaced (the begin attribute doesn't say irrevocable and no 
changeMode). It seems to happen when one transaction is followed by 
another one (Not sure if it is the cause)

I would like to have a look at it but I will be on vacation next week 
and I have to finish urgent things...

(I have added Aldy as CC since he also has glob2 and it might interest him)

Should I fill a new PR for this even if I don't have any real testcase?

Thanks.
Patrick.


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-10 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #13 from Richard Henderson rth at gcc dot gnu.org 2011-03-10 
23:04:11 UTC ---
Author: rth
Date: Thu Mar 10 23:04:05 2011
New Revision: 170854

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=170854
Log:
PR 47952
* trans-mem.c (ipa_tm_create_version): Remap extern inline
functions to static inline clones.

Modified:
branches/transactional-memory/gcc/ChangeLog.tm
branches/transactional-memory/gcc/trans-mem.c


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-10 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #14 from Richard Henderson rth at gcc dot gnu.org 2011-03-10 
23:42:10 UTC ---
*** Bug 48021 has been marked as a duplicate of this bug. ***


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-10 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #15 from Richard Henderson rth at gcc dot gnu.org 2011-03-10 
23:45:53 UTC ---
(In reply to comment #12)
 Should I fill a new PR for this even if I don't have any real testcase?

Yes please.


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-10 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Richard Henderson rth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #16 from Richard Henderson rth at gcc dot gnu.org 2011-03-10 
23:46:38 UTC ---
Fixed, as far as I can tell.


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-09 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #8 from Aldy Hernandez aldyh at gcc dot gnu.org 2011-03-09 
12:41:11 UTC ---
Unless Patrick has reduced the test case, the only way I was able to reproduce
it was to build the entire Glob2 benchmark which he mentions.  It has lots of
dependencies, but is really easy to reproduce.

The dependencies are scons, libboost, SDL, OpenGL, speex, vorbis, ogg, ...  All
are yum installable from fedora.

To reproduce you must do:

$ scons COMPILER=GCC SYNC=FINETM

You can download the application here:
http://members.unine.ch/patrick.marlier/downloads/glob2.tar.bz2


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-09 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #9 from Richard Henderson rth at gcc dot gnu.org 2011-03-09 
21:14:51 UTC ---
Author: rth
Date: Wed Mar  9 21:14:45 2011
New Revision: 170836

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=170836
Log:
PR 47952
include/
* demangle.h (enum gnu_v3_ctor_kinds): Add gnu_v3_object_ctor_group.
(enum gnu_v3_dtor_kinds): Add gnu_v3_object_dtor_group.
libiberty/
* cp-demangle.c (cplus_demangle_fill_ctor): Accept
gnu_v3_object_ctor_group.
(cplus_demangle_fill_dtor): Accept gnu_v3_object_dtor_group.
(d_ctor_dtor_name): Recognize gnu_v3_object_ctor_group
and gnu_v3_object_dtor_group.

Modified:
branches/transactional-memory/include/ChangeLog.tm
branches/transactional-memory/include/demangle.h
branches/transactional-memory/libiberty/ChangeLog.tm
branches/transactional-memory/libiberty/cp-demangle.c


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-09 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #10 from Richard Henderson rth at gcc dot gnu.org 2011-03-09 
23:01:38 UTC ---
The remaining problem in the full glob2 test is


src/Unit.o: In function `transaction clone for Unit::~Unit()':
Unit.cpp:(.text._ZGTtN4UnitD2Ev[transaction clone for Unit::~Unit()]+0x2c):
undefined reference to `transaction clone for std::basic_stringchar,
std::char_traitschar, std::allocatorchar ::~basic_string()'
collect2: ld returned 1 exit status


which really really doesn't exist.  No amount of marking this
function weak is going to work.

I suspect, but have not yet verified, that this is related to


  // Inhibit implicit instantiations for required instantiations,
  // which are defined via explicit instantiations elsewhere.
  // NB: This syntax is a GNU extension.
#if _GLIBCXX_EXTERN_TEMPLATE  0
  extern template class basic_stringchar;


in that we're copying the is extern bit, which is not true for
the transactional clone.


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-09 Thread patrick.marlier at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #11 from Patrick Marlier patrick.marlier at gmail dot com 
2011-03-10 04:31:30 UTC ---
This issue has been filled here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48021

There is also a reduced testcase. (If I remember well the namespace std
matters).

Patrick.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48021

On Thu, Mar 10, 2011 at 12:01 AM, rth at gcc dot gnu.org 
gcc-bugzi...@gcc.gnu.org wrote:

 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

 --- Comment #10 from Richard Henderson rth at gcc dot gnu.org 2011-03-09
 23:01:38 UTC ---
 The remaining problem in the full glob2 test is


 src/Unit.o: In function `transaction clone for Unit::~Unit()':
 Unit.cpp:(.text._ZGTtN4UnitD2Ev[transaction clone for Unit::~Unit()]+0x2c):
 undefined reference to `transaction clone for std::basic_stringchar,
 std::char_traitschar, std::allocatorchar ::~basic_string()'
 collect2: ld returned 1 exit status


 which really really doesn't exist.  No amount of marking this
 function weak is going to work.

 I suspect, but have not yet verified, that this is related to


  // Inhibit implicit instantiations for required instantiations,
  // which are defined via explicit instantiations elsewhere.
  // NB: This syntax is a GNU extension.
 #if _GLIBCXX_EXTERN_TEMPLATE  0
  extern template class basic_stringchar;


 in that we're copying the is extern bit, which is not true for
 the transactional clone.

 --
 Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
 --- You are receiving this mail because: ---
 You reported the bug.



[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-08 Thread patrick.marlier at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #6 from Patrick Marlier patrick.marlier at gmail dot com 
2011-03-08 10:17:58 UTC ---
Created attachment 23582
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=23582
testcase from glob2.

With the committed patch and this attached testcase, we get this

.text._ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,axG,@progbits,_ZGTt67_ZNSt14_List_iteratorIN4Game12BuildProjectEEC5EPSt15_List_node_base,comdat

instead of

.text._ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,axG,@progbits,_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC5EPSt15_List_node_base,comdat

Patrick Marlier.


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-08 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Richard Henderson rth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-08 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #7 from Richard Henderson rth at gcc dot gnu.org 2011-03-08 
22:27:31 UTC ---
The name isn't being properly demangled.  Although this ought not
matter for correctness; what matters is that the group name is
consistent across all uses, and that functions that are not 
related are not grouped together.  I'll still see about fixing
the demangler such that the group name is handled.

Can you please point me at the full test, so that I can see the
linker errors?


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-07 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Aldy Hernandez aldyh at gcc dot gnu.org changed:

   What|Removed |Added

  Attachment #23513|0   |1
is obsolete||

--- Comment #2 from Aldy Hernandez aldyh at gcc dot gnu.org 2011-03-07 
15:32:09 UTC ---
Created attachment 23571
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=23571
assembly with undefined references in clone table

This is the assembly file that has the following undefined references:

src/Game.o:(.tm_clone_table+0x108): undefined reference to `transaction clone
for std::_List_iteratorBuilding*::_List_iterator(std::_List_node_base*)'
src/Game.o:(.tm_clone_table+0x258): undefined reference to `transaction clone
for
std::_List_iteratorGame::BuildProject::_List_iterator(std::_List_node_base*)'

The 2nd reference is the following mangled symbol:

_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-07 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Aldy Hernandez aldyh at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Aldy Hernandez aldyh at gcc dot gnu.org 2011-03-07 
15:37:06 UTC ---
[These notes are from a question via email to Jakub/Richard.  Saving here to
keep everything in one place.  Still awaiting response.]

In this PR we have an undefined reference to symbol
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base (see
full .s in attachment). This symbol is only used in the .tm_clone_table:

 .section .tm_clone_table,aw,@progbits
[...]
 .quad _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base
[...]

However, the symbol seems to be an alias to another symbol (which is used):

.globl _ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base
.set
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC1EPSt15_List_node_base,
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base

Notice these are constructor variants (C1 versus C2 in the mangling).

The original symbol is defined like this:

.section
.text._ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,axG,@progbits,_ZNSt14_List_iteratorIN4Game12BuildProjectEEC5EPSt15_List_node_base,comdat
.align 2
.weak
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base
.type
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base,
@function
_ZGTtNSt14_List_iteratorIN4Game12BuildProjectEEC2EPSt15_List_node_base:
[...]
[...]

This is a wild guess, but should we avoid dumping symbols in the
.tm_clone_table if the original function was a weak symbol?  The one-liner
below, fixes the undefined reference at hand, as well as a myriad of other
linking problems in the Glob2 benchmark.

??

Index: varasm.c
===
--- varasm.c(revision 170622)
+++ varasm.c(working copy)
@@ -5867,6 +5867,9 @@ finish_tm_clone_pairs_1 (void **slot, vo
   if (!src_n-needed)
 return 1;

+  if (DECL_WEAK (src_n-decl))
+return 1;
+
   if (!*switched)
 {
   switch_to_section (get_named_section (NULL, .tm_clone_table, 3));


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-07 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Richard Henderson rth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
 AssignedTo|unassigned at gcc dot   |rth at gcc dot gnu.org
   |gnu.org |


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-07 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Richard Henderson rth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|WAITING

--- Comment #4 from Richard Henderson rth at gcc dot gnu.org 2011-03-08 
00:39:15 UTC ---
Patrick, I suspect that something like your DECL_COMDAT thing is needed,
but can you please attach a real test case here?  From the comments it
looks like you passed the test case to Aldy off-line?


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-07 Thread rth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

--- Comment #5 from Richard Henderson rth at gcc dot gnu.org 2011-03-08 
00:44:41 UTC ---
Author: rth
Date: Tue Mar  8 00:44:37 2011
New Revision: 170768

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=170768
Log:
PR 47952
* trans-mem.c (tm_mangle): Pass in and return an identifier.
(ipa_tm_create_version): Update to match.  Also mangle the
DECL_COMDAT_GROUP.

Modified:
branches/transactional-memory/gcc/ChangeLog.tm
branches/transactional-memory/gcc/trans-mem.c


[Bug c++/47952] [trans-mem] undefined reference to transaction clone

2011-03-02 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47952

Aldy Hernandez aldyh at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2011.03.02 19:03:48
 Ever Confirmed|0   |1

--- Comment #1 from Aldy Hernandez aldyh at gcc dot gnu.org 2011-03-02 
19:03:48 UTC ---
I can't reproduce the error.  Instead, I get:

houston:/build/tm/gcc$ /build/tm/install/bin/c++ a.c -fgnu-tm -O0 -fgnu-tm
-litm
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccOXn6kg.o: In function `buildProjectSyncStepConcurrently()':
a.c:(.text+0x23): undefined reference to `transaction clone for
Game::isHardSpaceForBuilding()'
/tmp/ccOXn6kg.o: In function `transaction clone for
buildProjectSyncStepConcurrently()':
a.c:(.text+0xe0): undefined reference to `transaction clone for
Game::isHardSpaceForBuilding()'
collect2: ld returned 1 exit status

As I see no definition for isHardSpaceForBuilding() in the source (just a
prototype), I expect this error.

Did you give me an incorrect testcase, or perhaps this is a binutils (linker)
problem (I'm using binutils-2.20.51.0.7-6.fc14.x86_64).

??