[Bug c++/30679] New: One RTTI bug in g++(4.1.0) .

2007-02-02 Thread sailzeng at tencent dot com
I write a test program .
//
#include 
#include 

#include 

//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."< (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 , 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 
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



[Bug c++/30679] One RTTI bug in g++(4.1.0) .

2007-02-02 Thread sailzeng at tencent dot com


--- 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