public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58272] New: unnecessary vtables emission for pure abstract classes
@ 2013-08-29 15:44 froydnj at gcc dot gnu.org
2013-08-31 12:48 ` [Bug c++/58272] " hubicka at gcc dot gnu.org
2021-08-11 21:34 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: froydnj at gcc dot gnu.org @ 2013-08-29 15:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58272
Bug ID: 58272
Summary: unnecessary vtables emission for pure abstract classes
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: froydnj at gcc dot gnu.org
CC: hubicka at ucw dot cz
Consider the following testcase:
class Interface {
public:
virtual int f() = 0;
};
class Concrete : public Interface {
public:
virtual int f();
};
int
Concrete::f()
{
return 2;
}
Concrete*
do_stuff()
{
Concrete* c = new Concrete();
return c;
}
int
call_f()
{
Interface* i = do_stuff();
return i->f();
}
compiling this on x86-64 with:
g++ -fno-exceptions -S -o - -O2 vtables.cpp -fno-rtti
produces output with a vtable for Interface, which is completely unused in the
compilation unit. (Still does it when omitting -fno-rtti, so it's not a
missing check for typeinfo emission or similar.)
Mozilla has a fair number of these and even though one can eliminate them via
--gc-sections, they still take up time to assemble, write to disk, etc. etc.
Honza and I were talking about them and we did not know whether it was an ABI
requirement that they be emitted or merely a bug in the compiler. G++ appears
to have some smarts about emitting the vtable for Concrete, so I am somewhat
surprised that it doesn't have similar smarts for the vtable for Interface.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/58272] unnecessary vtables emission for pure abstract classes
2013-08-29 15:44 [Bug c++/58272] New: unnecessary vtables emission for pure abstract classes froydnj at gcc dot gnu.org
@ 2013-08-31 12:48 ` hubicka at gcc dot gnu.org
2021-08-11 21:34 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: hubicka at gcc dot gnu.org @ 2013-08-31 12:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58272
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org
--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Current mainline seems to optimize Interace out completely. If this is correct,
we probably ought to add it to testsuite?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/58272] unnecessary vtables emission for pure abstract classes
2013-08-29 15:44 [Bug c++/58272] New: unnecessary vtables emission for pure abstract classes froydnj at gcc dot gnu.org
2013-08-31 12:48 ` [Bug c++/58272] " hubicka at gcc dot gnu.org
@ 2021-08-11 21:34 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 21:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58272
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
Known to work| |4.9.0
Keywords| |missed-optimization
Target Milestone|--- |4.9.0
Known to fail| |4.1.2, 4.4.7, 4.7.1, 4.8.1,
| |4.8.5
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Been fixed since 4.9.0.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-11 21:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29 15:44 [Bug c++/58272] New: unnecessary vtables emission for pure abstract classes froydnj at gcc dot gnu.org
2013-08-31 12:48 ` [Bug c++/58272] " hubicka at gcc dot gnu.org
2021-08-11 21:34 ` pinskia at gcc dot gnu.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).