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 

Derived type definition and private attribute

 
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: Thu Dec 13, 2018 12:40 am    Post subject: Derived type definition and private attribute Reply with quote

Is this a bug? Should the private declaration in the header of the module def, prevent the main program from finding the definition of the type test_t?

Code:
module def
implicit none

private

type test_t
  integer x
end type test_t

end module def


program main
use def
implicit none
type(test_t) :: a

  a%x = 1
  print *,a%x
 
end program main



Or an explicit private applied to the type definition:-

Code:
module def
implicit none

private

type, private :: test_t
  integer x
end type test_t

end module def


program main
use def
implicit none
type(test_t) :: a

  a%x = 1
  print *,a%x
 
end program main


In both of the above cases the private declaration(s) have no impact. FTN95 seems to differ from other compiliers on this one.

Ken
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Dec 13, 2018 12:15 pm    Post subject: Reply with quote

Ken

I think you are right and I have added code to fix this for the next version of FTN95 after 8.40.
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



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

PostPosted: Sat Dec 15, 2018 1:09 pm    Post subject: Reply with quote

Thanks Paul,

Another one for you to consider. This compiles with no errors, which I think is wrong since mod_b should have no access to the definition of z_t.

Code:
module a_mod
implicit none

  type xy_t
    integer x, y   
  end type xy_t

  type z_t
    integer z
  end type z_t

end module a_mod


module b_mod
use a_mod, only : xy_t
implicit none

type(z_t) something(1:10)  !FTN95 ignores the only directive

end module b_mod
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sat Dec 15, 2018 3:03 pm    Post subject: Reply with quote

Thanks Ken. I have logged this for investigation.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Mon Dec 31, 2018 8:43 am    Post subject: Reply with quote

This one has now been fixed for the next release of FTN95.
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