|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
StamK
Joined: 12 Oct 2016 Posts: 159
|
Posted: Mon Jul 01, 2019 9:10 pm Post subject: Not compiling with /UNDEF |
|
|
This is a bit strange, but with /undef it fails. The code is:
Code: |
!ftn95$free
MODULE CPP_SHARED
TYPE CPP_STRUCT_TYPE
INTEGER, POINTER :: CPP_INTEGER => NULL()
REAL, POINTER :: CPP_REAL => NULL()
END TYPE
TYPE(CPP_STRUCT_TYPE), DIMENSION(50,50) :: CPP_STRUCTURE
CONTAINS
SUBROUTINE INITIALISE_CPP_STRUCTURES()
INTEGER IWIN, IFLD
DO IWIN = 1, 50, 1
DO IFLD = 1, 50, 1
CPP_STRUCTURE(IWIN, IFLD)%CPP_INTEGER => NULL()
CPP_STRUCTURE(IWIN, IFLD)%CPP_REAL => NULL()
END DO
END DO
END SUBROUTINE
end module
|
The error is:
Code: |
************** Compiling testnull
0017) CPP_STRUCTURE(IWIN, IFLD)%CPP_INTEGER => NULL()
*** Error 1188: This pointer assignment would assign a pointer to the wrong kind of data
0018) CPP_STRUCTURE(IWIN, IFLD)%CPP_REAL => NULL()
*** Error 1188: This pointer assignment would assign a pointer to the wrong kind of data
0017) CPP_STRUCTURE(IWIN, IFLD)%CPP_INTEGER => NULL()
*** Error 250: You cannot assign an expression of type void to a variable of type INTEGER(KIND=3)
*** Error 891: Different types in pointer assignment - the left hand side is INTEGER(KIND=3), yet the right is void
0018) CPP_STRUCTURE(IWIN, IFLD)%CPP_REAL => NULL()
*** Error 250: You cannot assign an expression of type void to a variable of type REAL(KIND=1)
*** Error 891: Different types in pointer assignment - the left hand side is REAL(KIND=1), yet the right is void
6 ERRORS [<INITIALISE_CPP_STRUCTURES> FTN95 v8.51.1]
*** Compilation failed
|
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Tue Jul 02, 2019 7:41 am Post subject: |
|
|
First of all I only get error 1188 and I am puzzled by this.
FTN95 does not allow =>NULL() in this context but you can use NULLIFY....
Code: | NULLIFY(CPP_STRUCTURE(IWIN, IFLD)%CPP_INTEGER) |
Having said this, the initialising on line 5 has already done this for you at least in the first instance.
At the moment I don't know what the Fortran Standard says about this.
p.s. I need to look further into this. It compiles OK without /CHECK. |
|
Back to top |
|
|
StamK
Joined: 12 Oct 2016 Posts: 159
|
Posted: Tue Jul 02, 2019 9:56 am Post subject: |
|
|
This is what I use to compile
ftn95 /windows /undef /f2k /sparam 1 /cfpp
Without the /undef it compiles fine. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Tue Jul 02, 2019 12:05 pm Post subject: |
|
|
This will now be accepted by FTN95 in the next release. It currently works without /CHECK and will in future also work with /CHECK (and any options such as /UNDEF that imply /CHECK). |
|
Back to top |
|
|
|
|
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
|