View previous topic :: View next topic |
Author |
Message |
qt
Joined: 23 Aug 2005 Posts: 46 Location: Berlin, Germany
|
Posted: Fri Jul 24, 2015 4:22 pm Post subject: error 144 - Type has been declared but ... :: a bug? |
|
|
A customer sent me the following source code. When FTN95 compiles it the error 144 is output, although we can't see that there is anything faulty. We have checked with other compilers, which didn't complain:
Code: |
module type1_module
private
public type1
type :: type1
integer :: id
end type type1
end module type1_module
!----------------------------------------------------------
module module1
private
public msg_len
public func1 ! delete this line and the error is gone
integer, parameter :: msg_len=256
contains
! if this function is deleted the error is gone
function func1(t1_inst1) result(ierr)
use type1_module, only: type1
type(type1), intent(in) :: t1_inst1
integer:: ierr
ierr=0
end function func1
end module module1
!----------------------------------------------------------
module module2
use module1, only: msg_len
! if the following 2 lines are activated -> no error
! private
! public msg
character(len=msg_len) :: msg
end module module2
!----------------------------------------------------------
program main
use type1_module, only: type1
use module2, only: msg
type(type1) :: t1_inst2
msg='Main running...' !ftn95 v7.20 error: Type TYPE(TYPE1) has been declared but not defined
write(6,*) msg
t1_inst2%id=2 !ftn95 v5.40 error: id is not a component of TYPE1
end program main
|
You will have noticed a few comments. For example, if you delete line 19, the error 144 is gone. This is definitely strange. Please check.
Thank you.
Joerg Kuthe
www.qtsoftware.com |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Sat Jul 25, 2015 3:55 am Post subject: |
|
|
Changing the order of the USE statements at line 52:53 also removes the problem. . Code: | program main
use module2, only: msg
use type1_module, only: type1
type(type1) :: t1_inst2
msg='Main running...' !ftn95 v7.20 error: Type TYPE(TYPE1) has been declared but not defined
write(6,*) msg
t1_inst2%id=2 !ftn95 v5.40 error: id is not a component of TYPE1
end program main
|
It looks to me that type1 is becoming private in module1, although %id is being recognised ?
private/public can cause problems I never fully understand, although it does appear to be a bug
John |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sat Jul 25, 2015 8:31 am Post subject: |
|
|
Joerg
Thank you for your post.
I have logged this as a bug that needs fixing. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Jun 08, 2016 3:31 pm Post subject: |
|
|
This has now been fixed for the next release. |
|
Back to top |
|
|
|