Article View: gnu.g++.bug
Article #310g++ version 1.35.0, sunos 4.0.3 on sun 4/260
From: Michael Allen
Date: Mon, 31 Jul 1989 21:49
Date: Mon, 31 Jul 1989 21:49
39 lines
1309 bytes
1309 bytes
I wanted to overload the builtin hex function to take an unsigned
argument, so I tried:
====================Cut Here for file tryhex.cc===========================
#include <stream.h>
char* hex(unsigned ux, int width =0)
{
if ( long(ux) < 0 )
{
if ( width )
return form(form("%d%%x",width),ux);
else
return form("%x",ux);
}
else
return hex(long(ux));
}
int main()
{
unsigned long z = 0xffffffff; // its signed value is -1
cout << "z = " << z << " decimal, " << hex(z) << " hex.\n";
return 0;
}
====================Cut Here===========================
Results of 'g++ -c tryhex.cc'
In function int main ():
tryhex.cc:20: Segmentation violation
g++: Program cc1plus got fatal signal 11.
I also tried this with the -O flag and the -g flag, each gave the same
error.
Thanks,
Michael Allen
Technical Details
Message-ID:
<8907312149.AA01272@mtfsun.>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!UXC.CSO.UIUC.EDU!mtfsun!allenShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!UXC.CSO.UIUC.EDU!mtfsun!allen From: mtfsun!allen@UXC.CSO.UIUC.EDU (Michael Allen) Newsgroups: gnu.g++.bug Subject: g++ version 1.35.0, sunos 4.0.3 on sun 4/260 Message-ID: <8907312149.AA01272@mtfsun.> Date: 31 Jul 89 21:49:13 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: allen@fnnet.fnal.gov Distribution: gnu Organization: GNUs Not Usenet Lines: 39