This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/4248: reinterpret_cast in template
- To: "Denkhaus, Volker" <Volker dot Denkhaus at softwareag dot com>
- Subject: Re: c++/4248: reinterpret_cast in template
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Mon, 10 Sep 2001 16:42:09 +0100
- CC: "'rodrigc at gcc dot gnu dot org'" <rodrigc at gcc dot gnu dot org>, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Organization: Codesourcery LLC
- References: <DFF2AC9E3583D511A21F0008C7E6210609EAE9@softwareag.com>
"Denkhaus, Volker" wrote:
>
> Hi,
>
> it is hard to provide a sample. First of all it needs the Runtime and SDK of
> our product (DCOM for Linux), plus the application project of our customer.
> This would be a lot of stuff. Also I currently do not know if I am allowed
> to forward the customer stuff (source also inlcuded). Would it help to send
> only the binaries and some of our source files (at least the file where the
> dump occurs which is in a hedaer file that belongs to our SDK).
no. I suspect your build has become skewed, most probably a header file
has changed and some object file has not been recompiled, or
you're picking up the wrong version of a library.
ldd can tell you the libraries being used.
If you can't reduce it down to a simple test case, because whenever you
do the bug goes away, then it is incredably likely to be version skew.
> This is the code:
template <class Base>
class CComTearOffObject : public Base
{
public:
CComTearOffObject(void* pv)
{
ATLASSERT(m_pOwner == NULL);
this->m_pOwner = reinterpret_cast<CComObject<typename Base::_OwnerClass>*>(p
v);
this->m_pOwner->AddRef();
}
The AddRef call ends up in a segmentation fault. In the debugger I can see that the address of the
function AddRef which can be found in the vtable is calculated wrong.
is m_powner the expected value?, what is its type? How is the address
calculated wrong? Is the compiler using the wrong index into the vtable,
or does the right index contain the wrong value?
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org