public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time
@ 2006-07-13 9:41 caolanm at redhat dot com
2006-07-13 9:42 ` [Bug c++/28370] " caolanm at redhat dot com
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: caolanm at redhat dot com @ 2006-07-13 9:41 UTC (permalink / raw)
To: gcc-bugs
../unxlngi6.pro/slo/uuid.o: In function `create':
../../inc/rtl/instance.hxx:292: undefined reference to `(anonymous
namespace)::rtl_Instance<(anonymous namespace)::Pool, rtl::Static<(anonymous
namespace)::Pool, (anonymous namespace)::PoolHolder>::StaticInstance,
osl::Guard<osl::Mutex>, osl::GetGlobalMutex, int, int>::m_pInstance'
So, attachment 1 is my testcase testme.ii
with "g++ -c -fPIC -o testme.o testme.ii"
compiled with "g++ (GCC) 4.1.1 20060629 (Red Hat 4.1.1-6)" I get the following
attachment 2 output from nm
compiled with "g++ (GCC) 4.1.1 20060711 (Red Hat 4.1.1-7)" I get the following
attachment 3 output from nm
the above missing symbol is U in -7 and V in -6
--
Summary: undefined reference (to a complicated template
construct) at link time
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: caolanm at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
@ 2006-07-13 9:42 ` caolanm at redhat dot com
2006-07-13 9:43 ` caolanm at redhat dot com
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: caolanm at redhat dot com @ 2006-07-13 9:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from caolanm at redhat dot com 2006-07-13 09:42 -------
Created an attachment (id=11877)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11877&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
2006-07-13 9:42 ` [Bug c++/28370] " caolanm at redhat dot com
@ 2006-07-13 9:43 ` caolanm at redhat dot com
2006-07-13 9:43 ` caolanm at redhat dot com
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: caolanm at redhat dot com @ 2006-07-13 9:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from caolanm at redhat dot com 2006-07-13 09:43 -------
Created an attachment (id=11878)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11878&action=view)
original -6 nm output
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
2006-07-13 9:42 ` [Bug c++/28370] " caolanm at redhat dot com
2006-07-13 9:43 ` caolanm at redhat dot com
@ 2006-07-13 9:43 ` caolanm at redhat dot com
2006-07-13 11:06 ` caolanm at redhat dot com
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: caolanm at redhat dot com @ 2006-07-13 9:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from caolanm at redhat dot com 2006-07-13 09:43 -------
Created an attachment (id=11879)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11879&action=view)
new nm -7 output
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (2 preceding siblings ...)
2006-07-13 9:43 ` caolanm at redhat dot com
@ 2006-07-13 11:06 ` caolanm at redhat dot com
2006-07-13 11:54 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: caolanm at redhat dot com @ 2006-07-13 11:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from caolanm at redhat dot com 2006-07-13 11:06 -------
Created an attachment (id=11880)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11880&action=view)
diff against testme.ii which will make it work for me
This attachment is a diff against the testme.ii and makes the instance static
class member into a local static variable. Which is acceptable for my use case,
and works around the problem for me
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (3 preceding siblings ...)
2006-07-13 11:06 ` caolanm at redhat dot com
@ 2006-07-13 11:54 ` pinskia at gcc dot gnu dot org
2006-07-13 11:55 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-13 11:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-07-13 11:53 -------
This is invalid code with no diagnostic required.
See the full explaination in PR 28360 which is exactly the same case. In fact
with a real testcase :).
*** This bug has been marked as a duplicate of 28360 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (4 preceding siblings ...)
2006-07-13 11:54 ` pinskia at gcc dot gnu dot org
@ 2006-07-13 11:55 ` pinskia at gcc dot gnu dot org
2006-07-13 12:19 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-13 11:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2006-07-13 11:55 -------
Basicially the code was violating ODR rules before because of the anonymous
namespace.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] undefined reference (to a complicated template construct) at link time
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (5 preceding siblings ...)
2006-07-13 11:55 ` pinskia at gcc dot gnu dot org
@ 2006-07-13 12:19 ` pinskia at gcc dot gnu dot org
2006-07-13 14:08 ` [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-13 12:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2006-07-13 12:19 -------
Note I think you should have first checked FSF 4.1.2 which will have not this
issue. 4.2.0 might have it, I might had been wrong at closing as a dup, that
might be because I am tried and had a long day and it is 9:20 pm here already.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
Version|4.1.1 |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (6 preceding siblings ...)
2006-07-13 12:19 ` pinskia at gcc dot gnu dot org
@ 2006-07-13 14:08 ` pinskia at gcc dot gnu dot org
2006-07-13 16:25 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-13 14:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2006-07-13 14:08 -------
Here is a full reduced self contained testcase:
namespace
{
template< typename Inst>
struct rtl_Instance
{
static int * m_pInstance;
};
template< typename Inst> int * rtl_Instance< Inst>::m_pInstance = 0;
}
int *foo(void)
{
return rtl_Instance<int >::m_pInstance;
}
int main (void)
{
return foo() == 0;
}
--------------------
It is only happens the namespace is anonymous which is why this is 4.2 only
regression. Jason also applied his patch to redhat's 4.1 branch.
Caolan, please next time test against a FSF release of the compiler before
filing a bug because sometimes redhat backports patches to their branch.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |link-failure
Last reconfirmed|0000-00-00 00:00:00 |2006-07-13 14:08:03
date| |
Summary|undefined reference (to a |[4.2 Regression] undefined
|complicated template |reference to template class
|construct) at link time |static variable in an
| |anonymous namespace
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (7 preceding siblings ...)
2006-07-13 14:08 ` [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace pinskia at gcc dot gnu dot org
@ 2006-07-13 16:25 ` jakub at gcc dot gnu dot org
2006-07-13 16:50 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-07-13 16:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2006-07-13 16:25 -------
The reason why the var is not emitted seems to be that
note_vague_linkage_var is not called on it in finish_static_data_member_decl.
If I replace
if (! processing_template_decl && TREE_PUBLIC (decl))
note_vague_linkage_var (decl);
back with:
if (! processing_template_decl)
note_vague_linkage_var (decl);
it works just fine.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (8 preceding siblings ...)
2006-07-13 16:25 ` jakub at gcc dot gnu dot org
@ 2006-07-13 16:50 ` jakub at gcc dot gnu dot org
2006-07-16 20:17 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-07-13 16:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2006-07-13 16:50 -------
Testing a patch.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2006-07-13 14:08:03 |2006-07-13 16:50:42
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (9 preceding siblings ...)
2006-07-13 16:50 ` jakub at gcc dot gnu dot org
@ 2006-07-16 20:17 ` jakub at gcc dot gnu dot org
2006-07-16 22:24 ` pinskia at gcc dot gnu dot org
2006-08-28 12:29 ` jakub at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-07-16 20:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jakub at gcc dot gnu dot org 2006-07-16 20:17 -------
Subject: Bug 28370
Author: jakub
Date: Sun Jul 16 20:17:20 2006
New Revision: 115503
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115503
Log:
PR c++/28370
* decl2.c (note_vague_linkage_var): Removed.
(finish_static_data_member_decl): Add decl to pending_statics vector
directly. Do it even for non-public decls.
* g++.dg/template/anon3.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/template/anon3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (10 preceding siblings ...)
2006-07-16 20:17 ` jakub at gcc dot gnu dot org
@ 2006-07-16 22:24 ` pinskia at gcc dot gnu dot org
2006-08-28 12:29 ` jakub at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-16 22:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from pinskia at gcc dot gnu dot org 2006-07-16 22:24 -------
Fixed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
` (11 preceding siblings ...)
2006-07-16 22:24 ` pinskia at gcc dot gnu dot org
@ 2006-08-28 12:29 ` jakub at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-08-28 12:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jakub at gcc dot gnu dot org 2006-08-28 12:29 -------
Subject: Bug 28370
Author: jakub
Date: Mon Aug 28 12:28:55 2006
New Revision: 116506
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116506
Log:
PR c++/28370
* decl2.c (note_vague_linkage_var): Removed.
(finish_static_data_member_decl): Add decl to pending_statics vector
directly. Do it even for non-public decls.
* g++.dg/template/anon3.C: New test.
Added:
branches/redhat/gcc-4_1-branch/gcc/testsuite/g++.dg/template/anon3.C
Modified:
branches/redhat/gcc-4_1-branch/gcc/ChangeLog
branches/redhat/gcc-4_1-branch/gcc/cp/decl2.c
branches/redhat/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28370
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2006-08-28 12:29 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-13 9:41 [Bug c++/28370] New: undefined reference (to a complicated template construct) at link time caolanm at redhat dot com
2006-07-13 9:42 ` [Bug c++/28370] " caolanm at redhat dot com
2006-07-13 9:43 ` caolanm at redhat dot com
2006-07-13 9:43 ` caolanm at redhat dot com
2006-07-13 11:06 ` caolanm at redhat dot com
2006-07-13 11:54 ` pinskia at gcc dot gnu dot org
2006-07-13 11:55 ` pinskia at gcc dot gnu dot org
2006-07-13 12:19 ` pinskia at gcc dot gnu dot org
2006-07-13 14:08 ` [Bug c++/28370] [4.2 Regression] undefined reference to template class static variable in an anonymous namespace pinskia at gcc dot gnu dot org
2006-07-13 16:25 ` jakub at gcc dot gnu dot org
2006-07-13 16:50 ` jakub at gcc dot gnu dot org
2006-07-16 20:17 ` jakub at gcc dot gnu dot org
2006-07-16 22:24 ` pinskia at gcc dot gnu dot org
2006-08-28 12:29 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).