Article View: gnu.g++.bug
Article #1779compilation gives core using g++.1-34.1 on sun4-os4
From: gerry wiener
Date: Wed, 22 Mar 1989 13:36
Date: Wed, 22 Mar 1989 13:36
42 lines
1241 bytes
1241 bytes
Compiling following program taken from C++Programming by John Berry (pg22)
generates a core dump using g++-1.34.1 on sun4-os4:
hail:gerry:1>g++ p22.c
In function int main ():
p22.c:25: Segmentation violation
Program c++ got fatal signal 11.
hail:gerry:2>
If x.area is replaced by x.area() and y.area is replaced by y.area()
it compiles correctly.
-------------------------------------------------------------------------------
#include <stream.h>
struct square
{
int side;
void set(int);
int area();
};
void square::set(int x)
{
side = x;
}
int square::area()
{
return(side*side);
}
main()
{
square x, y;
x.set(2);
cout << "area of square x = " << x.area << "\n";
y.set(3);
cout << "area of square y = " << y.area << "\n";
}
Technical Details
Message-ID:
<8903221336.AA04378@toadwar.UCAR.EDU>Path:
arc1-ca.pugleaf.net!utzoo!yunexus!telly!attcan!uunet!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerryShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!yunexus!telly!attcan!uunet!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerry From: gerry@TOADWAR.UCAR.EDU (gerry wiener) Newsgroups: gnu.g++.bug Subject: compilation gives core using g++.1-34.1 on sun4-os4 Message-ID: <8903221336.AA04378@toadwar.UCAR.EDU> Date: 22 Mar 89 13:36:59 GMT Article-I.D.: toadwar.8903221336.AA04378 Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 42