forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem with intent(in) dummy argument in read input list

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
JohnyBergmann



Joined: 21 Nov 2005
Posts: 5

PostPosted: Wed Dec 07, 2005 6:49 am    Post subject: problem with intent(in) dummy argument in read input list Reply with quote

The following test program exposes a problem with the compiler, which does not detect the use of the dummy arguments a and b as input items.
Furthermore, on return from the function call, the actual arguments are modified in the calling program.
[pre]
module m

contains

integer function countlines(a,b)
integer, intent(in):: a,b
integer n, ios

ios = 0
n = 0
do while (ios == 0)
read(10,"(i4)",iostat=ios) a,b
if (a > b) then
n = n + 1
endif
enddo
countlines = n
end function countlines
end module m

program intent_1
use m
integer a,b,nlines

open(10,file="test.txt")
write(10,"(i4)") 5, 6
write(10,"(i4)") 7, 8
write(10,"(i4)") 3, 0
write(10,"(i4)") 9 ,7
rewind(10)

a = 1
b = 2
nlines = countlines(a,b)

print *,a,b,nlines

end program intent_1
[/pre]
Compiled with ftn95 intent_0.f90 /ISO /RES /LGO
the output is: 9 7 3
This would be the correct result with intent(inout) arguments, but in the present case one would expect a compile error.



Johny
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Thu Dec 08, 2005 1:51 am    Post subject: problem with intent(in) dummy argument in read input list Reply with quote

Johny

Thanks for this. We will aim to investigate the problem as soon as we can.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Thu Apr 20, 2006 1:37 am    Post subject: problem with intent(in) dummy argument in read input list Reply with quote

This bug has now been fixed for the next release.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group