Subject: lib/3417: libstdc++ dumps core
To: None <>
From: Krister Walfridsson <>
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
>Originator:     Krister Walfridsson
>Release:        NetBSD-current as of March 29, 1997
System: NetBSD 1.2D NetBSD 1.2D (KWA) #5: Sun Mar 30 09:23:32 MEST 1997 sparc

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...

Compile this on a sparc, with the command
   gcc bug.C -lstdc++

#include <strstream.h>

main(int argc, char **argv)
  strstream str1;

  str1 << "Testing string-based stream using strstream.\n";

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