🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51779

double load/store instructions on Sparcs using gcc v 2.3.3

#51779
From: Sam Southard
Date: Sun, 28 Mar 1993 06:47
43 lines
3090 bytes
I maintain large package for Sun Sparcs running SunOS 4.1.x which is written in
a combination of fortran, traditional C, and ANSI C, and is compiled using
Sun's f77 and cc (not acc) compilers and gcc.  I've just traced a core dump
problem to the fact that f77 and cc by default do not generate double
load/store instructions, while gcc apparently does.

I say apparently because I can find no information in the gcc manual page which
mentions that this is the case.  However, when I call a gcc-compiled routine
from a Fortran routine with a double pointer which is aligned on a 4-byte
boundary but not on an 8-byte boundary I get a core dump.

Theoretically, I could simply give the -dalign flag to f77 and cc, but the f77
man page contains a warning:

     -dalign   Sun-4   only.     Generate    double    load/store
               instructions    wherever   possible   for   faster
               execution.   Using   this   option   automatically
               triggers  the  -f option (see  below) to cause all
               double typed  data  to  be  double  aligned.  With
               -dalign  ,  you  may not get ANSI standard FORTRAN
			   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               alignment - a tradeoff of portability  for  speed.
	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               See also Shared Libraries in Programming Utilities
               and Libraries . If you  compile  one  module  with
               -dalign,  compile  all modules of the program with
               -dalign.  -dalign is unsuitable for  modules  that
               access  double-precision  data that is not aligned
               on 8-byte boundaries; unexpected  bus  errors  may
               occur.

I'm particularly concerned about the indicated section because once of the
things this set of programs does is read files from other systems (VAXen,
specifically).

Is there a way to prevent gcc from generating double load/store instructions?
If not, it would appear to be a bug, as it would seem to be impossible to
compile a routine with gcc and be sure that it could be callable from a Fortran
routine which uses "ANSI standard FORTRAN alignment" (whatever that is - I must
confess I'm not well enough versed in Fortran to know).

In case it matters, I'm using gcc version 2.3.3 and f77 version 1.3.1 on Sun
Sparstation 1s, 1+s, 2s, IPCs, IPXs, and 10s, running SunOS 4.1.[123].
Technical Details
Message-ID: <1p3hlvINNbks@elroy.jpl.nasa.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!bondi.jpl.nasa.gov!sns

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,be0f8c6795b8ff2b,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-03-27 22:49:07 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!bondi.jpl.nasa.gov!sns
From: sns@bondi.jpl.nasa.gov (Sam Southard)
Newsgroups: gnu.gcc.help
Subject: double load/store instructions on Sparcs using gcc v 2.3.3
Date: 28 Mar 1993 06:47:27 GMT
Organization: SAR Systems Development & Processing, JPL
Lines: 43
Distribution: world
Message-ID: <1p3hlvINNbks@elroy.jpl.nasa.gov>
NNTP-Posting-Host: bondi.jpl.nasa.gov
Summary: Is there a way to disable this?