replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Module conflicts
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 

Module conflicts
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Tue Mar 05, 2013 6:31 am    Post subject: Reply with quote

I think I cleared up almost all my USE statements a while ago, but I'm still getting a few odd outcomes. However, it seems that ONLY does not seem to function as I would expect. For example, the following program uses module m1, but only subroutine s1. However, the program calls s2, which has not been used, and the program still compiles, runs, and gives the correct result. Although s2 is not declared as private, I would still have thought that the ONLY would have made it invisible to the program.

Code:
MODULE m1
 INTEGER :: i1
CONTAINS
 SUBROUTINE s1 ()
  i1=1
  PRINT *, i1
 END SUBROUTINE s1
 SUBROUTINE s2 ()
  i1=2
  PRINT *, i1
 END SUBROUTINE s2
END MODULE m1
!
PROGRAM p
  USE m1, ONLY: s1
  CALL s2 ()
END PROGRAM p


Last edited by simon on Wed Apr 10, 2013 10:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Mar 05, 2013 9:57 am    Post subject: Reply with quote

I have logged this for investigation.
Back to top
View user's profile Send private message AIM Address
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Thu Apr 04, 2013 8:32 am    Post subject: Reply with quote

I have run into this issue too. As far as I can see the ONLY list is being ignored by the compiler and everything in the module that isn't private becomes accessible.

Code:

module mmm

contains

   subroutine xxx
      print *, 'xxx called'
   end subroutine xxx

   subroutine yyy
      print *, 'yyy called'
   end subroutine yyy

end module mmm

program main

   use mmm, only : xxx

   call xxx
   call yyy  ! Shouldn't work, but does!

end


In this code, the explist shows the second call uses the module name decoration.

CALL MMM!YYY

It should say

CALL YYY

so that the error can be detected by the Linker or at Run-time.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Apr 16, 2013 2:01 pm    Post subject: 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
Goto page Previous  1, 2
Page 2 of 2

 
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