Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"write" changes variable values?!?

Status
Not open for further replies.

Biggeonline

Technical User
Mar 10, 2009
2
DE
Hi @ all!

I've got a little problem and hope to find sombody here who can help me...
I have to debug a code at the moment (wild mixture of all Fortran styles... well, I didn't write it) which looks more or less like this:

Code:
subroutine bla(variable1,...)
...
real*8 variable1,variable2
...
write(*,*) variable1
variable2=variable1+...
...
return 
end

Means the write comes just behind the initialization - but I've found out, that it doesn't really matter where in my subroutine it stands.

My problem is now:
the values (e.g. for variable2) the routine above yields are different from those from a version where the write statement is deleted or in a comment.
How can that be? What can I do to avoid this?

I hope that somebody can give me a tip on that...

Thanks in advance!

Bigge
 
1) is variable2 passed to the routine or is it a local variable?

2) What are you passing into the routine - is it two real*8 or something different? Trace all the way up - is it always real*8 or does it change from integer to real*4 to real*8?
 
Hi xwb!

ad 1) variable2 is a local variable.

ad 2) variable1 is passed from the calling routine as real*8. I checked on the format, which is the same in calling and answering routine, and even the value is the same.
As variable1 is not the only one I transfer from the calling routine I checked all of them and they seem alright - even the arrays are OK (format, size, values).

Do you have any idea what happens here?
I'm grateful for any tip!

Thx,
Bigge
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top