From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,d2d487db2409a45,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-09-14 15:58:33 PST Path: bga.com!news.sprintlink.net!uunet!MathWorks.Com!news.duke.edu!phy.duke.edu!mjb From: mjb@phy.duke.edu (Michael John Bergmann) Newsgroups: comp.sys.dec Subject: analigned error on Alpha using gcc and f2c Date: 14 Sep 1994 14:34:45 GMT Organization: Duke University Physics Department; Durham, N.C. Distribution: world Message-ID: <3571m5$4kb@news.duke.edu> NNTP-Posting-Host: parsec.phy.duke.edu I have a number of linpack routines that I am using to solve a large tridiagonal matrix system. These routines are in fortran, of course, and the rest of my code is in C. On the Suns I just convert the Fortran to C and compile it with gcc and no problems arise. When I run it on the Alphas, I still get no compiler errors, but I do get the "Unaligned access" run time error. I am using gcc V2.4 with the following flags: gcc -O2 -ansi -Wcast-align -Wcast-qual -Wall Note that the warning flags produce no compiler errors. I get the following run time errors though: >Unaligned access pid=26629 va=11ffff694 reg=31 type=stq pc=120005560 ra=120005554 >Unaligned access pid=26629 va=11ffff68c reg=1 type=ldq pc=1200055d8 ra=120005554 where an aligned datum is a data object that are powers of two in size. Some of my Attempts/Ideas for Fixes ********************************** 1. Use cc rather than gcc. No luck, I still get a memory run time error. 2. Machine dependent switches in gcc to align memorty correctly. No luck, no such switch for the Alpha architecture. 3. Maybe f2c needs help. Well I have noticed that f2c says to link in the libraries libF77.a and libI77.a. These libraries don't exit on the Alphas, so maybe this is the problem. (Note that in a newer release of f2d it says you only need libf2c.a and not the two above files. libf2c.a is on the Alpha's and I use it to link to and everything compiles fine, so it appears that this isn't the problem) Also I have used a newer f2c to comvert the code and it produce an identical converted file. So no luck again. 4. Look through New groups vms.alpha and compilers.com for any posts dealing with this. No help here. 5. I see that gcc on the Aphas is version 2.4 and the sun is 2.6. I don't know if this matters, maybe it's a bug that's been fixed. Where in the Code the problem Occurs ************************************ I am including the code that produces the run time error. The place the first unaligned access occurs is marked by @@@@@@@@@. start file dgbfa.f ******************************************************************* /* dgbfa.f -- translated by f2c (version of 23 April 1993 18:34:30). You must link the resulting object file with the libraries: -lF77 -lI77 -lm -lc (in that order) */ #include "f2c.h" static integer c__1 = 1; /* Subroutine */ int dgbfa_(doublereal *abd, integer *lda, integer *n, integer *ml, integer *mu, integer *ipvt, integer *info) { integer abd_dim1, abd_offset, i__1, i__2, i__3, i__4; static integer i, j, k, l, m; static doublereal t; extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, integer *), daxpy_(integer *, doublereal *, doublereal *, integer *, doublereal *, integer *); static integer i0, j0, j1, lm, mm, ju; extern integer idamax_(integer *, doublereal *, integer *); static integer jz, kp1, nm1; /* Parameter adjustments */ --ipvt; abd_dim1 = *lda; abd_offset = abd_dim1 + 1; abd -= abd_offset; /* Function Body */ @@@@@@@@@@@@@( here is the first unaligned access. It looks fine to me but apparently not) m = *ml + *mu + 1; ********************************************************************** If you have ever had a similar problem I would appreciate knowing how you fixed it. mike -- Michael John Bergmann 919-660-2547 Duke University Dept. of Physics box 90305 Durham, NC 27708-0305 (home) 956-8439 -- Michael John Bergmann 919-660-2547 Duke University Dept. of Physics box 90305 Durham, NC 27708-0305 (home) 956-8439