Summary: RTTI Gives Segmentation Fault - Solaris 2.6 - CC 5.0

From: Sudheesh Krishnankutty <sudheesh_at_softjin.com>
Date: Wed Jun 13 2001 - 01:05:33 EDT
This is a multi-part message in MIME format.
--------------3DD66C1F51C2EEBBFFFC0392
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Hi Sunmanagers,

    Actually I didn't get any reply for my question.  May be because it is
a problem related
to programming.

  Finally after breaking my head when I got the solution it was so simple.

  Apply the patch 107311-13.

regards

sudheesh

Sudheesh Krishnankutty wrote:

> Hi Sunmanagers,
>
> There seems to be some problem with running executable
> generated by CC 5.0 here, IF I am using RTTI.
> I feel the problem is with libCrun, and not CC 5.0 as such.
>
> When I am using RTTI class typeid member functions, I am getting core
> dump.
> For eg. on executing the following line as part of a template function
> if (typeid(T) == typeid(int)) { ... }
> it gives a core dump as
> signal SEGV (no mapping at the fault address) in
> std::type_info::operator== at 0xef785d08
>
> Instead of above code, even if I use typeid::name() as, say,
> printf("%s", typeid(T).name());
> it gives core dump as
> signal SEGV (no mapping at the fault address) in std::type_info::name
> at
> 0xef785f24
>
> The executable uses libCrun.so which has the above functions.
> ---------------------------------------------------------------------
> sun1> ldd ./a.out
>         libCrun.so.1 =>  /usr/lib/libCrun.so.1
>         libm.so.1 =>     /opt/SUNWspro/lib/libm.so.1
>         libw.so.1 =>     /usr/lib/libw.so.1
>         libc.so.1 =>     /usr/lib/libc.so.1
>         libdl.so.1 =>    /usr/lib/libdl.so.1
>         /usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
> ---------------------------------------------------------------------
>
> Is it some problem with the libCrun.so here? I mean, is that
> library corrupted?
> Or is there some patch that needs to be applied?
> The above program runs FINE with g++. I saw that g++ generated
> executable
> does not used libCrun.so.
>
> For your reference, I am including the test program and sample run.
>
> 1) The test program I used : rt.C :
> ---------------------------------------------------------------------
> #include <stdio.h>
> #include <typeinfo>
>
> using namespace std;
>
> template <class T>
> class A {
>     private:
>         T t;
>     public:
>         A() : t(0) { }
>         A(const T& t1) : t(t1) { }
>         void Print() { if (typeid(T) == typeid(int)) printf("%d\n", t);
> }
>         // void Print() { printf("%s\n", typeid(T).name()); }
> };
>
> main()
> {
>     A<int> b(5);
>     b.Print();
> }
> ---------------------------------------------------------------------
>
> 2) After compiling as "CC -g rt.C", A run using dbx of a.out gives
> ---------------------------------------------------------------------
> sun1> dbx ./a.out
> test: -s: unknown operand
> Reading a.out
> Reading ld.so.1
> Reading libCrun.so.1
> Reading libm.so.1
> Reading libw.so.1
> Reading libc.so.1
> Reading libdl.so.1
> Reading libc_psr.so.1
> (dbx) run
> Running: a.out
> (process id 18808)
> signal SEGV (no mapping at the fault address) in
> std::type_info::operator== at 0xef785d08
> 0xef785d08: operator==+0x0008:  ld      [%o5 + 0xc], %o4
> Current function is A<int>::Print
>    13           void Print() { if (typeid(T) ==
> typeid(int)) printf("%d\n", t); }
> (dbx)
> ---------------------------------------------------------------------
>
> Can you please tell the source of error and the fix?
> We have applied the patches.  will reapplying the patches help?
>
> Regards,
> Sudheesh

--------------3DD66C1F51C2EEBBFFFC0392
Content-Type: text/x-vcard; charset=us-ascii;
 name="sudheesh.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Sudheesh Krishnankutty
Content-Disposition: attachment;
 filename="sudheesh.vcf"

begin:vcard 
n:Krishnankutty;Sudheesh
tel;fax:91-80-5234643
tel;home:91-487-338217
tel;work:91-80-5234641
x-mozilla-html:TRUE
org:Softjin Infotech Pvt Ltd;Electronics Design Automation
version:2.1
email;internet:sudheesh@softjin.com
title:Software Engineer
adr;quoted-printable:;;No. 227/70/A, Sigma Arcade,=0D=0AMarathahalli,=0D=0AAirport Road;Bangalore;Karnataka;560037;India
fn:Sudheesh Krishnankutty
end:vcard

--------------3DD66C1F51C2EEBBFFFC0392--
Received on Wed Jun 13 06:05:33 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:24:56 EDT