Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: Call Array ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 11 Topic 8155 of 8908
Post > Topic >>

Re: Call Array valued Fortran function from C

by "James Van Buskirk" <not_valid@[EMAIL PROTECTED] > Apr 20, 2008 at 09:21 PM

"James Van Buskirk" <not_valid@[EMAIL PROTECTED]
> wrote in message 
news:yLGdnReybdwp_ZbVnZ2dnUVZ_vOdnZ2d@[EMAIL PROTECTED]
>          These are what I came up with via reverse engineering
> gfortran assembly language output.

Oh yeah, another thing I noticed from the assembly language code
was that if you compiled with the -fomit-frame-pointer switch the
compiler generated code that accessed at negative offsets from rsp.

I'm sure the gcc guys have been around he block on this one several
times already, but is it really safe to do this?  In SWConventions.doc
that comes with the Windows SDK, it says:

"First, all memory beyond the current address of RSP is considered
volatile:  The OS, or a debugger, may overwrite this memory during
a user debug session, or an interrupt handler.  Thus, RSP must
always be set before attempting to read or write values to a stack
frame."

The same verbiage may be found at
http://msdn2.microsoft.com/en-us/library/x4ea06t0(VS.80).aspx
.
This is not the case in Linux where there is a 128-byte red zone
below rsp, according to Agner Fog.  Now going to
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fomit_002dframe_002dpointer-592
it is do***ented that -fomit-frame-pointer makes debugging
impossible on some machines, so this covers one rationale for
Microsoft's proscription on gcc's usage, and the other rationale
seems dubious as well because the current task's context should
be saved in its TSS or some other place than its ring-3 stack,
and it would be senseless for ring-0 code such as an interrupt
handler to assume that a ring-3 stack has any space left to
safely write to.

Even so, writing to negative offsets from rsp seems to be contrary
to Microsoft's do***entation, so has someone at gcc taken this up
with Microsoft and made sure that it's OK?

-- 
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
 




 11 Posts in Topic:
Call Array valued Fortran function from C
koentjepoppe@[EMAIL PROTE  2008-04-19 10:33:39 
Re: Call Array valued Fortran function from C
glen herrmannsfeldt <g  2008-04-19 12:11:20 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-19 15:54:39 
Re: Call Array valued Fortran function from C
"FX" <couder  2008-04-19 22:23:33 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-19 17:14:50 
Re: Call Array valued Fortran function from C
"FX" <couder  2008-04-20 10:49:38 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-20 09:26:43 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-20 21:21:14 
Re: Call Array valued Fortran function from C
Sebastian Hanigk <hani  2008-04-20 09:44:34 
Re: Call Array valued Fortran function from C
nf.editor@[EMAIL PROTECTE  2008-04-20 08:56:10 
Re: Call Array valued Fortran function from C
"FX" <couder  2008-04-20 16:11:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Nov 19 8:27:03 CST 2008.