Subject: lib/3417: libstdc++ dumps core
To: None <gnats-bugs@gnats.netbsd.org>
From: Krister Walfridsson <cato@ulysses.df.lth.se>
List: netbsd-bugs
Date: 03/31/1997 08:42:40
>Number: 3417
>Category: lib
>Synopsis: libstdc++ dumps core
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 30 22:50:01 1997
>Last-Modified:
>Originator: Krister Walfridsson
>Organization:
>Release: NetBSD-current as of March 29, 1997
>Environment:
System: NetBSD ulysses.df.lth.se 1.2D NetBSD 1.2D (KWA) #5: Sun Mar 30 09:23:32 MEST 1997 cato@ulysses.df.lth.se:/usr/src/sys/arch/sparc/compile/KWA sparc
>Description:
libstdc++ dies on the following program when it tries to jump through
a NULL pointer, which it gets (as far I can see) because cc1 and cc1plus
doesn't align data the same way, but I don't know C++ good enough to
know if this is a bug in g++, or if libstdc++ makes unvalid assumptions...
>How-To-Repeat:
Compile this on a sparc, with the command
gcc bug.C -lstdc++
#include <strstream.h>
int
main(int argc, char **argv)
{
strstream str1;
str1 << "Testing string-based stream using strstream.\n";
}
>Fix:
I don't have a real fix, but this work around solves the problem.
--- libg++/libio/strfile.h.orig Mon Mar 31 08:24:07 1997
+++ libg++/libio/strfile.h Mon Mar 31 08:23:54 1997
@@ -40,7 +40,7 @@
{
struct _IO_FILE _f;
const void *_vtable;
- struct _IO_str_fields _s;
+ struct _IO_str_fields _s __attribute__ ((aligned(8)));
} _IO_strfile;
/* dynamic: set when the array object is allocated (or reallocated) as
>Audit-Trail:
>Unformatted: