public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/64670] -fsanitize=vptr leads to "undefined reference to `typeinfo for class'"
Date: Tue, 10 Feb 2015 08:09:00 -0000	[thread overview]
Message-ID: <bug-64670-4-DIy2UKMSxO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64670-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64670

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #8)
> (In reply to Tobias Burnus from comment #5)
> > Updated test case (part 1/2): [main file] compile with g++ -fsanitize=vptr
> so the #pragma implementation doesn't match.  If I change it to be "test2.h"
> I get the typeinfo for LogListener.

I have to admit that I am lost - is there a good explanation of #pragma
implementation/interface somewhere?


In the real code, one has something like the following, which I tried to mimic
in the test case. If I understood your comment correctly, I should use in
"log.c" not only 'implementation "log.h"' but additionally(?) 'implementation
"LogListener.h"' - i.e. using 'pragma implementation' for LogListener.h's
classes only in LogListener.h is not sufficient?


----- LogListener.h ------
// Complete file except for "..." bits and #include lines.
#pragma interface
class LogListener
{
 public:
  virtual ~LogListener() {}
  virtual void listen( const Cstring& input) = 0;
  // virtual ... = 0;  // some more
}
class AccumulatingLogListener : public LogListener {...};


----- LogListener.cc ------
// matches approx. attachment 34628
// As it is short, that's really the complete file
#pragma implementation

#include "LogListener.h"
void AccumulatingLogListener::listen( const Cstring& input) {
  m_buffer += input;
}


----- log.h ------
#pragma interface

class LogListener;
class Log_Handler {....};


----- log.c ------
// matches approx. attachment 34627
#pragma implementation "log.h"
#include "log.h"
#include "LogListener.h"

// implementation of Log_Handler, which causes -fsanitize=vptr to access
// "typeinfo for name LogListener", which is "U".

----------------------------------------------------


The real-world LogListener.o has (full output as it is short):
000000000000006d t
_GLOBAL__sub_D_00099_0__ZN23AccumulatingLogListener6listenERK7Cstring
0000000000000082 t
_GLOBAL__sub_I_00099_1__ZN23AccumulatingLogListener6listenERK7Cstring
0000000000000000 W LogListener::LogListener()
0000000000000000 W LogListener::LogListener()
0000000000000000 W LogListener::~LogListener()
0000000000000000 W LogListener::~LogListener()
0000000000000000 W LogListener::~LogListener()
0000000000000000 T AccumulatingLogListener::listen(Cstring const&)
0000000000000000 W AccumulatingLogListener::AccumulatingLogListener(int)
0000000000000000 W AccumulatingLogListener::AccumulatingLogListener(int)
0000000000000000 W AccumulatingLogListener::~AccumulatingLogListener()
0000000000000000 W AccumulatingLogListener::~AccumulatingLogListener()
0000000000000000 W AccumulatingLogListener::~AccumulatingLogListener()
0000000000000000 W AccumulatingLogListener::getContent() const
0000000000000000 W AccumulatingLogListener::eatsMessages() const
0000000000000000 W AccumulatingLogListener::isAccumulatingLogListerner() const
0000000000000000 V typeinfo for LogListener
0000000000000000 V typeinfo for AccumulatingLogListener
0000000000000000 V typeinfo name for LogListener
0000000000000000 V typeinfo name for AccumulatingLogListener
0000000000000000 V vtable for LogListener
0000000000000000 V vtable for AccumulatingLogListener


  parent reply	other threads:[~2015-02-10  8:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 15:32 [Bug sanitizer/64670] New: " burnus at gcc dot gnu.org
2015-01-19 15:58 ` [Bug sanitizer/64670] " burnus at gcc dot gnu.org
2015-01-19 16:07 ` mpolacek at gcc dot gnu.org
2015-01-19 16:14 ` jakub at gcc dot gnu.org
2015-01-29 15:52 ` jason at gcc dot gnu.org
2015-01-30 13:15 ` burnus at gcc dot gnu.org
2015-02-09 16:42 ` burnus at gcc dot gnu.org
2015-02-09 22:00 ` jason at gcc dot gnu.org
2015-02-10  8:09 ` burnus at gcc dot gnu.org [this message]
2015-02-10 16:23 ` jason at gcc dot gnu.org
2015-02-10 16:26 ` burnus at gcc dot gnu.org
2015-02-10 16:32 ` jason at gcc dot gnu.org
2015-02-10 16:50 ` burnus at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-64670-4-DIy2UKMSxO@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).