View previous topic :: View next topic |
Author |
Message |
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sat Oct 14, 2017 4:01 pm Post subject: Function not returning imaginary part of complex number |
|
|
Another one for you Paul, - at least its not related to the native %pl !
I had thought 64 bit had broken my conductor impedance calculation program, but after some work I generated some simple code which behaves differently between 32 and 64 bit.
The following code works fine in 32 bit and returns the expected function value (4 + j4).
Code: | program test
implicit none
complex(kind=2) z
complex(kind=2) i0 ; external i0
z = cmplx(4.d0,4.d0)
write(6,*) z, i0(z)
end program test
complex(kind=2) function i0(z)
implicit none
complex(kind=2), intent(in) :: z
i0 = z
! return !## Uncomment this return statement and 64 bit works same as 32
end function i0 |
64 bit returns the incorrect function value (4 + j0), i.e. the imaginary part of the complex number is incorrect. If the comment before the return statement in the function i0 is removed, 64 bit behaves as expected.
Regards
Ken |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Sun Oct 15, 2017 12:45 am Post subject: |
|
|
I cannot reproduce the bug with the 8.10 compiler + DLLS13.
Please state which version of the compiler you used and the options that you specified. |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sun Oct 15, 2017 11:30 am Post subject: |
|
|
I was using windows 10, 8.10 compiler and DLL14. Checkmate 64 and Release 64 both generate the unexpected results.
Reverting back to DLL13 - I still see the same unexpected behaviour.
Interestingly if I change all the complex kinds from 2 to 1 the output is as expected (for DLL14).
[/img] |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Sun Oct 15, 2017 1:50 pm Post subject: |
|
|
Perhaps there are some Plato settings that affect the compilation? This is what I see at the command window, with just /nocolour in my FTN95.CFG.
Code: | s:\FTN95>ftn95 ks.f90 /lgo
[FTN95/Win32 Ver. 8.10.0 Copyright (c) Silverfrost Ltd 1993-2017]
0003) complex(kind=2) z
COMMENT - Specifying the kind of the type COMPLEX with a constant is non-portable - 'SELECTED_REAL_KIND(15,307)' would be
better
NO ERRORS, 1 COMMENT [<TEST> FTN95 v8.10.0]
NO ERRORS [<I0> FTN95 v8.10.0]
Creating executable: s:\FTN95\lgotemp@.exe
Program entered
(4.00000000000,4.00000000000) (4.00000000000,4.00000000000)
s:\FTN95>ftn95 ks.f90 /64 /lgo
[FTN95/x64 Ver. 8.10.0 Copyright (c) Silverfrost Ltd 1993-2017]
0003) complex(kind=2) z
COMMENT - Specifying the kind of the type COMPLEX with a constant is non-portable - 'SELECTED_REAL_KIND(15,307)' would be
better
NO ERRORS, 1 COMMENT [<TEST> FTN95 v8.10.0]
NO ERRORS [<I0> FTN95 v8.10.0]
[SLINK64 v1.8, Copyright (c) Silverfrost Ltd. 2015-2017]
Loading s:\FTN95\lgotemp@.obj
Creating executable file s:\FTN95\lgotemp@.exe
Program entered
(4.00000000000,4.00000000000) (4.00000000000,4.00000000000) |
|
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sun Oct 15, 2017 3:53 pm Post subject: |
|
|
It's been a long time since I compiled Fortran from the command line, but it does not appear to be Plato that's causing the problem.
|
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Sun Oct 15, 2017 11:33 pm Post subject: |
|
|
I have reproduced the error with two versions of 8.10.0:
.dll (13?) dated 18/09/2017
.dll (orig) dated 11/02/2017
I used ftn95complex /64 /lgo /list
.lis reported
Silverfrost FTN95/x64 Ver 8.10.0 complex.f90 Mon Oct 16 09:26:59 2017
Compiler Options in Effect:
64 COLOUR DELETE_OBJ_ON_ERROR ERROR_NUMBERS IMPLICIT_NONE INTL LGO LIST
LOGL MINIMISE_REBUILD NO_QUIT NON_STANDARD SINGLE_THREADED |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Oct 16, 2017 11:33 am Post subject: |
|
|
I have made a note that this bug needs fixing. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Oct 16, 2017 6:04 pm Post subject: |
|
|
This has now been fixed for the next release. |
|
Back to top |
|
|
|