From: "Oliver Fuhrer" <[log in to unmask]>
Sent: Thursday, 8 December 2011 9:29 PM
>The NAG compiler is giving me a headache and I'm not sure if it's my fault or his. If I compile the code >below (using
>"nagfor -nan test.f90") and execute, I get an "Runtime Error: *** Arithmetic exception:
>Floating invalid operation - aborting" at the assignement statement in sub. The "-nan" option is telling
>the compiler to initialize all variables with NaN's in order to catch usage of unitialized values. It seems
> that NAG is initializing the intent(out) argument (i.e. b) with NAN's upon entry to the routine but
> without working on a copy of the data. Since the same argument is passed twice,
> the valid content is being overwritten. I tried searching the Fortran standard
> if the code below is legal or not, and I think it is. Who's to blame?
You are permitted to pass the value of A twice,
but you are not permitted to alter that value in the subroutine.
|