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 

Possible (minor) bug

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



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Wed May 03, 2023 11:53 am    Post subject: Possible (minor) bug Reply with quote

With FTN95 the following code executes both the write statements in sub1. This is incorrect as access to the functions compiler_version() and compiler_options() from iso_fortran_env should be prevented by the ONLY statement.
Code:
module t_mod
use iso_fortran_env, only : INT8
implicit none
contains
  subroutine sub1
    write(6,'(/A,1X,I1)') 'Kind number of a 8  bit integer is', int8
    write(6,'(/A,1X,A)') 'Compiled with',   compiler_version()
    write(6,'(/A,1X,A)') 'Compiler options',compiler_options()
  end subroutine sub1
end module t_mod

program main
use t_mod
  call sub1
end program main


Fortunately this error appears to relate only to the functions in iso_fortran_env, and it is not apparent in the general case with user written code. FTN95 behaves as expected in the following example, i.e. sub1 has no access to function f2.
Code:
module a_mod
implicit none
contains
  integer function f1()
   f1 = 1
  end function f1
 
  integer function f2()
    f2 = 2
  end function f2
end module a_mod

module b_mod
use a_mod, only : f1
implicit none
contains
  subroutine sub1
    write(6,*) f1()
    write(6,*) f2()
  end subroutine sub1
end b_mod

program main
use b_mod
  call sub1
end program main
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed May 03, 2023 12:14 pm    Post subject: Reply with quote

Thanks Ken. I have made a note of this.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Sun May 07, 2023 8:41 am    Post subject: Reply with quote

This has now been fixed. It affects FTN95 and also the content of the iso_fortran_env module.
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