diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-04-05 09:41:39 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-04-05 09:41:39 +0000 |
commit | ae09d348360dbb821fd377fb24ace18dc8b5c263 (patch) | |
tree | 8dcb9344d2060659067fb53436b591f03349d001 /lib/make/known-architectures/linux | |
parent | f394369323200b61ba96cbbe1f2294826d22c663 (diff) |
Add '-Mx,125,0x200' to F77FLAGS and F90FLAGS when using Portland compilers.
This is a workaround for calling C varargs functions from Fortran.
Thanks to Roberto De Pietri who had reported this problem to the PGI developers.
Here is the full explanation he got from them:
======================================================================== ==
Joined: 30 Jun 2004
Posts: 99
Location: Portland Group
PostPosted: Wed Sep 29, 2004 9:56 am Post subject: Problem only on Opterons Reply with quote
This is a problem that only occurs on Opterons when using Fortran to C
with varargs. When you compile a C program on Opteron using varargs,
the EAX register is expected to contain the number of XMM registers
that will be used for the varargs. When you call a C function with
varargs from Fortran the EAX register is not set since its not needed
in Fortran. Since EAX contains garbage, the C varargs becomes
corrupt.
To work around this problem is to use the x flag "-Mx,125,0x200" which
will set EAX to zero before every call. Note that we generally do not
release x flags to the public since they are for the compiler's
internal use, new, or experimental. So the caveat to using this
flag is that it has not been properly QA'd and is subject to change.
However, I believe in this case we plan to give it a name in a
future release.
========================================================================
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4020 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make/known-architectures/linux')
-rw-r--r-- | lib/make/known-architectures/linux | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/make/known-architectures/linux b/lib/make/known-architectures/linux index 8dedf9c4..e5d85089 100644 --- a/lib/make/known-architectures/linux +++ b/lib/make/known-architectures/linux @@ -184,6 +184,9 @@ else if test -z "$LIBDIRS" ; then LIBDIRS="`which $F90 | sed 's,/bin/.*,/lib,'`" fi + # workaround for calling C varargs functions from Fortran + : ${F77FLAGS='-Mx,125,0x200'} + : ${F90FLAGS='-Mx,125,0x200'} : ${F77_OPTIMISE_FLAGS='-fast -Minfo -Mneginfo -Mvect=assoc'} : ${F90_OPTIMISE_FLAGS='$(F77_OPTIMISE_FLAGS)'} : ${F77_DEBUG_FLAGS='-g'} |