[apt4ssx8] Re: Compiling apt360 with g77

  • From: Brent Muller <bmuller@xxxxxxxxxxxx>
  • To: apt4ssx8@xxxxxxxxxxxxx
  • Date: Wed, 27 Jun 2012 13:13:05 -0600

On 6/27/2012 10:54 AM, Jon Elson wrote:
Brent Muller wrote:

There are two things that come to mind when porting: one, what would be the affect of running code made for big-endian machines on intel?
Properly written pure Fortran code should be very unlikely to suffer problems with this. You could certainly run into issues with assembler routines, or in places where several byte variables are commoned to a wider variable. Otherwise, the byte order

I think this problem, where smaller byte variables are commoned into a wider variable, was precisely the problem. At least that's how the C code of f2c generated it. To see the areas in the C code that you might cross-reference with the Fortran to verify, grep for "OTHER_ENDIAN" macros.

in a 32-bit variable should always be the same, so you should be able to ignore the endian-ness, as long as all I/O is character-based. If you read or write
binary files, then this becomes a big issue.

This shouldn't be a problem, since binary file writing was handled by assembler routines

I overcame this problem in the C code with macros everywhere this was a problem. Two, how do we call C code in the ASM file conversion from Fortran?
Mostly, it "just works". The one place where there is a big difference is that the way two-dimensional arrays are laid out in memory are opposite for C and Fortran.

Jon




Other related posts: