- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Program Main
- ...
- do loop=1,n
- call test1(...)
- enddo
- end Program Main
- subroutine test1(...)
- a=sin(2)
- b=cos(2)
- end subroutine test1
Here is the problem, when loop=1, both a and b got the correct value, while loop>=2, only b is correctly calculated and a=NaN. I can figure out what is the problem. Also I tried different codes, they both showed that only the frist expressioin with fortran internal function goes wrong. How to fix it..
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please show us an actual and complete source that shows the problem. My experience is that paraphrases and snippets almost always omit key information.
Is test1 actually a subroutine or is it a function? If you are calling a function as a subroutine (or vice versa) you can end up with symptoms like this. Generated interface checking usually detects this.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page