public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42340] New: templated member func vanish from assembler code when -O2 is used
@ 2009-12-09 10:41 jaeschke at de dot ibm dot com
2009-12-09 11:09 ` [Bug c++/42340] " paolo dot carlini at oracle dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jaeschke at de dot ibm dot com @ 2009-12-09 10:41 UTC (permalink / raw)
To: gcc-bugs
Using the below code snipped (bug.C), and compiling it using:
gcc -Wall -O2 -save-temps -c -o bug.o bug.C
causes _ZN1B1fIiEEvPT_ to disappear from the .s-file, and later on breaking the
link. Using -O1 works fine.
---- bug.C ----
struct B {
template <class T> void f(T * t);
void dummyInst();
};
template <class T> void
B::f(T * t)
{
}
void
B::dummyInst() {
f((int*)0);
}
--
Summary: templated member func vanish from assembler code when -
O2 is used
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jaeschke at de dot ibm dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42340
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/42340] templated member func vanish from assembler code when -O2 is used
2009-12-09 10:41 [Bug c++/42340] New: templated member func vanish from assembler code when -O2 is used jaeschke at de dot ibm dot com
@ 2009-12-09 11:09 ` paolo dot carlini at oracle dot com
2009-12-09 11:29 ` redi at gcc dot gnu dot org
2009-12-09 11:34 ` paolo dot carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-09 11:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2009-12-09 11:08 -------
I'm seeing this happening in 4.3.x too, isn't new in 4.4.x.
Now, I'm not sure to understand which is the problem: indeed, it disappears,
but it's also true that nothing calls it. I would ask you to provide a short
testcase which doesn't link anymore and was fine before (4.2.x?). Thanks.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42340
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/42340] templated member func vanish from assembler code when -O2 is used
2009-12-09 10:41 [Bug c++/42340] New: templated member func vanish from assembler code when -O2 is used jaeschke at de dot ibm dot com
2009-12-09 11:09 ` [Bug c++/42340] " paolo dot carlini at oracle dot com
@ 2009-12-09 11:29 ` redi at gcc dot gnu dot org
2009-12-09 11:34 ` paolo dot carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-12-09 11:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from redi at gcc dot gnu dot org 2009-12-09 11:29 -------
If another translation unit is relying on finding an instantiation in bug.o
then you should use an explicit instantiation to ensure it is present, or the
other translation unit should include the definition of B::f
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42340
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/42340] templated member func vanish from assembler code when -O2 is used
2009-12-09 10:41 [Bug c++/42340] New: templated member func vanish from assembler code when -O2 is used jaeschke at de dot ibm dot com
2009-12-09 11:09 ` [Bug c++/42340] " paolo dot carlini at oracle dot com
2009-12-09 11:29 ` redi at gcc dot gnu dot org
@ 2009-12-09 11:34 ` paolo dot carlini at oracle dot com
2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-09 11:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo dot carlini at oracle dot com 2009-12-09 11:34 -------
This is expected, any optimizing compiler (e.g., ICC behaves the same as GCC)
will get rid of that implicit instantiation, while inlining. Really, this is
not going to change.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42340
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-09 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-09 10:41 [Bug c++/42340] New: templated member func vanish from assembler code when -O2 is used jaeschke at de dot ibm dot com
2009-12-09 11:09 ` [Bug c++/42340] " paolo dot carlini at oracle dot com
2009-12-09 11:29 ` redi at gcc dot gnu dot org
2009-12-09 11:34 ` paolo dot carlini at oracle dot com
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).