Article View: gnu.gcc.help
Article #49394g++/gcc on DEC Alpha
From: Bongjin.Choi
Date: Fri, 04 Feb 1994 23:10
Date: Fri, 04 Feb 1994 23:10
60 lines
1885 bytes
1885 bytes
Hello, all:
I'm compiling C++ code using g++ and linking the generated object files
using gcc. Of course, the C++ code uses none of the standard C++ stuff.
One problem, the executable crashes when a member function of the
virtual inherited class is called. However, the same code works on other
platforms. Here is the C++ code
extern "C" {
#include <stdio.h>
}
class Shape {
protected:
int a;
public:
Shape() {
a = 1;
}
virtual void test () {
printf ("shape test! %d\n", a);
}
};
class Circle: public Shape {
protected:
int b;
public:
Circle() {
b = 10;
}
void test () {
printf ("circle test! %d\n", b);
}
};
int main () {
Shape *s = new Shape;
Circle *c = new Circle;
s->test();
c->test();
}
The output for this program is
shape test! 1
and then CORE DUMP!
gcc on the DEC Alpha is 2.5.5 (also tried it with 2.5.7) and the version
on other platform (namely, DEC 3100 running Mach) is 2.3.2.
any ideas? thanks...
Bongjin
Technical Details
Message-ID:
<YhIhLBG00hMv0wJmhM@cs.cmu.edu>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!att-in!news.bu.edu!olivea!spool.mu.edu!howland.reston.ans.net!news.intercon.com!zilker.net!cs.utexas.edu!uunet!MathWorks.Com!europa.eng.gtefsd.com!news.umbc.edu!eff!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!andrew.cmu.edu!postman+Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,6fbda0dfabe41bce,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1994-02-05 05:24:56 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!att-in!news.bu.edu!olivea!spool.mu.edu!howland.reston.ans.net!news.intercon.com!zilker.net!cs.utexas.edu!uunet!MathWorks.Com!europa.eng.gtefsd.com!news.umbc.edu!eff!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!bb3.andrew.cmu.edu!andrew.cmu.edu!postman+ From: Bongjin.Choi@cs.cmu.edu Newsgroups: gnu.gcc.help Subject: g++/gcc on DEC Alpha Date: Fri, 4 Feb 1994 18:10:05 -0500 Organization: Carnegie Mellon, Pittsburgh, PA Lines: 60 Message-ID: <YhIhLBG00hMv0wJmhM@cs.cmu.edu> NNTP-Posting-Host: po5.andrew.cmu.edu