🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1728

g++ 1.34.0 sparc bug

#1728
From: James Clark
Date: Sun, 12 Mar 1989 11:49
32 lines
1356 bytes
I have looked further at the bug I reported to you earlier today (with
g++ 1.34.0 on the SPARC). It turns out to be a problem with ld++
If you compile and run the following, you'll see the problem.

static double x;

main()
{
  x = 1.0;
}

What happens is that the bss segment ends up being aligned
on a 4-byte boundary, which causes the program to generate
a bus error on execution.

The following diff seems to fix this problem:

*** ld.c.distrib	Sat Feb 25 21:41:56 1989
--- ld.c	Sun Mar 12 11:37:27 1989
***************
*** 2189,2194 ****
--- 2189,2195 ----
    outheader.a_text += N_ADDRADJ (outheader);
  #endif
  
+   data_size = (data_size + sizeof(double) - 1) & ~(sizeof(double)-1);
    /* Make the data segment address start in memory on a suitable boundary.  */
  
    data_start = N_DATADDR (outheader) + text_start - N_TXTADDR (outheader);

I don't really understand ld too well, so this may not be a
good fix, but it seems to work for me.
Technical Details
Message-ID: <8903121149.AA04023@jclark.uucp>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!jclark!jjc

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!jclark!jjc
From: mcvax!jclark!jjc@UUNET.UU.NET (James Clark)
Newsgroups: gnu.g++.bug
Subject: g++ 1.34.0 sparc bug
Message-ID: <8903121149.AA04023@jclark.uucp>
Date: 12 Mar 89 11:49:09 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 32