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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fortran overwrites variables that are not used

Status
Not open for further replies.

sirkolomay

Programmer
Jul 9, 2013
2
DK
Hi There,

I am trying to track down errors in my code and I found a very weird change of value in an array after a line, where I don't actually change the array itself:

CODE:
print*,"AAAAA*****3-4(1)********:z_dot_dot:),2)",z_dot_dot:),2)
dt(1:2) = 1.00d0
print*,"AAAAA*****3-4(2)********:z_dot_dot:),2)",z_dot_dot:),2)

Output:

AAAAA*****3-4(1)********:z_dot_dot:),2) 4.97277072539214647E-320 1.02048317795353139E-312 1.02048317795353139E-312
AAAAA*****3-4(2)********:z_dot_dot:),2) 4.97277072539214647E-320 1.0000000000000000 1.0000000000000000

Has anyone seen something like this before? Could someone help me on this?

Thanks a lot in advance,

Sirko
 
please, show us the declarations of the arrays z_dot_dot and dt.
If they are passed by argument, show us the calling sequence of the subroutine or function as well.

Clearly, the two arrays overlap and this may be caused by many possible programming mistakes...

François Jacq
 
Merci Francois,

yes, that was exactly the problem. When I allocated z_dot_dot(dimension_a), dimension_a was defined but no value was assigned yet. So the compiler didn't throw an error and z_dot_dot had no actual size.

Thanks again for your help,

Sirko
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top