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!

compiles fine, a.exe freezes

Status
Not open for further replies.

venomousmule

Technical User
Feb 23, 2008
2
US
I have a program that compiles fine in gfortran. When I execute the program runs and then freezes. It's not taking up CPU resources or memory, it just ceases to keep going. The program appears to be hanging on this line:

write (str1,'(I1)') radius

which doesn't make sense as I've used this line in another test program just fine (with the exact same declarations/values)

What confuses me is that the program compiles and runs without errors, it just stops at that point. Any ideas?
 
How is str1 declared and what is radius?

If radius is more than 1 digit and str1 has been declared to only hold 1 character, you're overwriting the local variable space and possibly the stack frame which would result in the program returning to somewhere else, not necessarily the routine that called it.
 
thanks for the response:

str1 is declared as a character, radius is only 1 digit.

I think there may be some issue here beyond programming. Since the last post the program has been run -unchanged- and now a.exe hangs right before closing an output file. Is this a gfortran compiler issue? I'm completely stumped, on the bright side, it is outputting the correct information.
 
Try declaring str1 as character*2.

Alternatively, instead of the write statement,
Code:
 str1 = char(radius + 48)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top