🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #302

ofstream bug in 2.1

#302
From: Wayne A. Christopher
Date: Tue, 29 Sep 1992 18:39
33 lines
1293 bytes
The following program causes an assertion failure in the ofstream
code.  I can't see what is wrong...  Any ideas?  I don't have 2.2 yet
so I haven't tested it there.

foo.cc:

#include <fstream.h>

static ofstream ofile;

main()
{
    ofile = ofstream("outputfile");    
    ofile << "Here is some output\n";
}

What happens:

% gcc-2.2.2 foo.cc -lg++-2_1
% gdb a.out
(gdb) run

Program received signal 6, Abort
0xf775f458 in kill ()
(gdb) where
#0  0xf775f458 in kill ()
#1  0xf77776fc in abort ()
#2  0xb93c in __overflow (sb=0x16650, c=72) at streambuf.C:186
#3  0xba4c in streambuf::sputn (this=0x16650, s=0x22a1 "ere is some output\n", 
    n=20) at streambuf.C:211
#4  0x5aa0 in operator<< (stream=@0x145b0, s=0x22a0 "Here is some output\n")
    at iostream.C:525
#5  0x2358 in main ()
Technical Details
Message-ID: <1aa7sjINN2rj@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ygdrasil.cs.berkeley.edu!faustus

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ygdrasil.cs.berkeley.edu!faustus
From: faustus@ygdrasil.cs.berkeley.edu (Wayne A. Christopher)
Subject: ofstream bug in 2.1
Message-ID: <1aa7sjINN2rj@agate.berkeley.edu>
Sender: gnulists@ai.mit.edu
Organization: University of California, Berkeley
Distribution: gnu
Date: Tue, 29 Sep 1992 18:39:15 GMT
Approved: bug-lib-g++@prep.ai.mit.edu
Lines: 34