public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30679] New: One RTTI bug in g++(4.1.0) .
@ 2007-02-02 13:43 sailzeng at tencent dot com
2007-02-03 7:19 ` [Bug c++/30679] " sailzeng at tencent dot com
0 siblings, 1 reply; 2+ messages in thread
From: sailzeng at tencent dot com @ 2007-02-02 13:43 UTC (permalink / raw)
To: gcc-bugs
I write a test program .
//
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
//TestA
class TestA;
class TestB;
class TestA
{
public:
TestA()
{
}
virtual ~TestA()
{
}
protected:
int abc_;
public:
//
static void Instance(TestA *instance)
{
instance_ = instance;
}
//
static TestA *Instance()
{
return instance_;
};
virtual void Output()
{
std::cout<<"Test A."<<std::endl;
}
public:
//
static TestA* instance_;
};
TestA* TestA::instance_ = NULL;
class TestB :public TestA
{
public:
TestB()
{
}
virtual ~TestB()
{
}
virtual void Output()
{
std::cout<<"Test B."<<std::endl;
}
protected:
int def_;
public:
//
static TestB *Instance()
{
return dynamic_cast<TestB *> (TestA::Instance());
};
};
int main(int argc,char *argv[])
{
TestA::Instance(new TestB());
TestB::Instance()->Output();
return 0;
}
But program code dump when running. GDB out info :
(gdb) where
#0 0x08071000 in ?? ()
#1 0x0804a140 in __dynamic_cast (from=0x80524b0, to=0x804dae0 <typeinfo for
TestA>, require_public=134535884, address=0x0,
sub=0xb7efbb90 <_dl_fini>, subptr=0xbf872a40)
#2 0x08049998 in main () at testcfg.cpp:64
I test find ,it core in last line
<TestB::Instance()->Output();>
I compile it with :
g++ -fvisibility=hidden -fvisibility-inlines-hidden -W -Wall -Wpointer-arith
-O3 -g -pipe -Wno-strict-aliasing -D_REENTRANT -DACE_HAS_AIO_CALLS
-D_GNU_SOURCE -DTOLUA_RELEASE -I/usr/local/ACE_wrappers -DACE_HAS_EXCEPTIONS
-D__ACE_INLINE__ -c -frtti -I/data/qqpet2/code/src/commlib
-I/data/qqpet2/code/src/zenlib -I/usr/local/mysql/include
-I/usr/local/ACE_wrappers -I/usr/local/sqlite-3.3.6/
-I/usr/local/lua-5.1.1/include testcfg.cpp -o object/testcfg.o
g++ -fvisibility=hidden -fvisibility-inlines-hidden -W -Wall -Wpointer-arith
-O3 -g -pipe -Wno-strict-aliasing -D_REENTRANT -DACE_HAS_AIO_CALLS
-D_GNU_SOURCE -DTOLUA_RELEASE -I/usr/local/ACE_wrappers -DACE_HAS_EXCEPTIONS
-D__ACE_INLINE__ -frtti -o../../bin/testcfg ./object/testcfg.o
-L/data/qqpet2/code/lib -lcommlib -L/data/qqpet2/code/lib -lzenlib
-L/usr/local/mysql/lib -lmysqlclient_r -lmygcc -lz
-L/usr/local/ACE_wrappers/lib -lACE -I/usr/local/sqlite-3.3.6/.libs/ -lsqlite3
-L/usr/local/lua-5.1.1/lib -llua -ltoluapp
My GCC version is:
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp --disable-libssp
--enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib
--with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --without-system-libunwind --with-cpu=generic
--host=i586-suse-linux
Thread model: posix
gcc version 4.1.0 (SUSE Linux)
--
Summary: One RTTI bug in g++(4.1.0) .
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sailzeng at tencent dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30679
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/30679] One RTTI bug in g++(4.1.0) .
2007-02-02 13:43 [Bug c++/30679] New: One RTTI bug in g++(4.1.0) sailzeng at tencent dot com
@ 2007-02-03 7:19 ` sailzeng at tencent dot com
0 siblings, 0 replies; 2+ messages in thread
From: sailzeng at tencent dot com @ 2007-02-03 7:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from sailzeng at tencent dot com 2007-02-03 07:19 -------
I am sorry . I find this bug have not relation with gcc.
<-L/usr/local/mysql/lib -lmysqlclient_r -lmygcc > cause this bug.
MySQL could compile with -fno-rtti.
By the way ,I find if I adjust link parameter order. Program run ok.
g++ -fvisibility=hidden -fvisibility-inlines-hidden -W -Wall -Wpointer-arith
-O3 -g -pipe -Wno-strict-aliasing -D_REENTRANT -DACE_HAS_AIO_CALLS
-D_GNU_SOURCE -DTOLUA_RELEASE -I/usr/local/ACE_wrappers -DACE_HAS_EXCEPTIONS
-D__ACE_INLINE__ -c -frtti -I/data/qqpet2/code/src/commlib
-I/data/qqpet2/code/src/zenlib -I/usr/local/mysql/include
-I/usr/local/ACE_wrappers -I/usr/local/sqlite-3.3.6/
-I/usr/local/lua-5.1.1/include testcfg.cpp -o object/testcfg.o
g++ -fvisibility=hidden -fvisibility-inlines-hidden -W -Wall -Wpointer-arith
-O3 -g -pipe -Wno-strict-aliasing -D_REENTRANT -DACE_HAS_AIO_CALLS
-D_GNU_SOURCE -DTOLUA_RELEASE -I/usr/local/ACE_wrappers -DACE_HAS_EXCEPTIONS
-D__ACE_INLINE__ -L/data/qqpet2/code/lib -lcommlib -L/data/qqpet2/code/lib
-lzenlib -L/usr/local/mysql/lib -lmysqlclient_r -lmygcc -lz
-L/usr/local/ACE_wrappers/lib -lACE -I/usr/local/sqlite-3.3.6/.libs/ -lsqlite3
-L/usr/local/lua-5.1.1/lib -llua -ltoluapp ./object/testcfg.o
-o../../bin/testcfg
--
sailzeng at tencent dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30679
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-03 7:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02 13:43 [Bug c++/30679] New: One RTTI bug in g++(4.1.0) sailzeng at tencent dot com
2007-02-03 7:19 ` [Bug c++/30679] " sailzeng at tencent 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).