public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18780] New: Segmentation fault using wofstream
@ 2004-12-02 10:56 phyfai at physics dot unimelb dot edu dot au
2004-12-02 11:06 ` [Bug c++/18780] " phyfai at physics dot unimelb dot edu dot au
2004-12-02 11:45 ` [Bug libstdc++/18780] " pcarlini at suse dot de
0 siblings, 2 replies; 3+ messages in thread
From: phyfai at physics dot unimelb dot edu dot au @ 2004-12-02 10:56 UTC (permalink / raw)
To: gcc-bugs
It seems wofstream and wostream get trouble when a L'\0' character is entered
into the middle of their buffer. wofstream generates a Segmentation fault when
flushing the buffer.
This is a very simple report so I just the source code here:
--* source *--
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
wofstream ff("tt", ios_base::binary);
ff<<L'A';
ff<<L'\0';
ff<<L'B';
cout<<"Still okay..."<<endl;
}
--* end source *--
Compile command: g++ -g test.C
--* output *--
prompt> a.out
Still okay...
Segmentation fault
--* end output *--
--* gdb *--
Starting program: /epp/home/phyfai/C-repository/utility/a.out
Breakpoint 1, main () at test.C:8
8 ff<<L'A';
(gdb) s
s9 ff<<L'\0';
(gdb) s
10 ff<<L'B';
(gdb) s
11 cout<<"Still okay..."<<endl;
(gdb) s
Still okay...
Program received signal SIGSEGV, Segmentation fault.
0x401999da in wcsnlen () from /lib/tls/libc.so.6
(gdb) s
Single stepping until exit from function wcsnlen,
which has no line number information.
Program terminated with signal SIGSEGV, Segmentation fault.
--* end gdb *--
I guess, at some point during conversion to external encoding, wcsnlen() is
called, and determine '\0' in buffer as end trigger some memory problem. wcout
doesn't generate segmentation fault, but stop displaying when it encounters a
L'\0'. ofstream and cout doesn't have this problem.
--
Summary: Segmentation fault using wofstream
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: phyfai at physics dot unimelb dot edu dot au
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18780
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/18780] Segmentation fault using wofstream
2004-12-02 10:56 [Bug c++/18780] New: Segmentation fault using wofstream phyfai at physics dot unimelb dot edu dot au
@ 2004-12-02 11:06 ` phyfai at physics dot unimelb dot edu dot au
2004-12-02 11:45 ` [Bug libstdc++/18780] " pcarlini at suse dot de
1 sibling, 0 replies; 3+ messages in thread
From: phyfai at physics dot unimelb dot edu dot au @ 2004-12-02 11:06 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet| |c-gc i486-linuxConfigured
| |with: ../src/configure -v --
| |enable-lan
GCC host triplet| |gcc version 3.3.3 (Debian)
GCC target triplet| |Debian Linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18780
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/18780] Segmentation fault using wofstream
2004-12-02 10:56 [Bug c++/18780] New: Segmentation fault using wofstream phyfai at physics dot unimelb dot edu dot au
2004-12-02 11:06 ` [Bug c++/18780] " phyfai at physics dot unimelb dot edu dot au
@ 2004-12-02 11:45 ` pcarlini at suse dot de
1 sibling, 0 replies; 3+ messages in thread
From: pcarlini at suse dot de @ 2004-12-02 11:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2004-12-02 11:45 -------
Hi. While I can reproduce the problem with gcc3.3.3, I can't with 3.4.3 or
current mainline (consider that for 3.4 iostreams have been profoundly reworked
both from the correctness and the performance points of view)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c++ |libstdc++
Resolution| |WORKSFORME
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18780
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-02 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-02 10:56 [Bug c++/18780] New: Segmentation fault using wofstream phyfai at physics dot unimelb dot edu dot au
2004-12-02 11:06 ` [Bug c++/18780] " phyfai at physics dot unimelb dot edu dot au
2004-12-02 11:45 ` [Bug libstdc++/18780] " pcarlini at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).