From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,11734b1d8c3fcb1c X-Google-Attributes: gid111c93,public From: laz@walleye.gonefishing.sk.ca (Larry Zimmerman) Subject: Re: A Fortran/C code malloc problem Date: 1999/03/25 Message-ID: <36fb216f.0@204.83.142.253>#1/1 X-Deja-AN: 459211080 References: <7d9vrc$clg$1@nnrp1.dejanews.com> X-Trace: thor.cal.sfl.net 922420987 204.83.142.253 (Thu, 25 Mar 1999 21:03:07 MDT) Organization: Shaw Fiberlink Ltd. (Calgary) NNTP-Posting-Date: Thu, 25 Mar 1999 21:03:07 MDT Newsgroups: comp.os.linux.alpha In article <7d9vrc$clg$1@nnrp1.dejanews.com>, b_duke@my-dejanews.com writes: >I have been struggling for some weeks with the port of an established >program to Alpha linux. It is a fortran code that calls a small >amount of C which in turn calls malloc to allocate dynamic memory. >The code below isolates the problem from the main program. It > Program TEST .. > LOFFS2 = (LOFFS1+7)/8 + 1 You might want to try using I*8 variables instead of constants. I have found problems with mixed size aritmetic. >with this C linked in:- > >long memget_(nwords) long *nwords; > { unsigned int nbytes; I think you should declare nbytes as long or size_t. >The problem is that the number returned by malloc is far too >large giving an offset from X(1) that is far too large. It is This was discussed on the redhat alpha list. The problem is that small amounts of memory are allocated in one place, and larger amounts are allocated at a higher address that is not contiguous with the rest of the program. >I would welcome any assistence. I have a similar scheme that seems to work for me. Check out: http://walleye.gonefishing.sk.ca click on the linux tidbits, then look for the g77 link. If this is useful to you, feel free to copy, use, modify it. Larry Z. -- signature withheld pending a patent/copyright search.