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 

Apparent regression bug in 8.10

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



Joined: 19 Jan 2017
Posts: 14

PostPosted: Wed Feb 22, 2017 10:18 am    Post subject: Apparent regression bug in 8.10 Reply with quote

Hi all,

First of all I would like to thank you for the new FTN95 release.

Unfortunately, one of our codes which is declaring a C_EXTERNAL function is not working properly since the update, what appears to be a regression bug introduced in FTN95 8.10 (happens in both 32 and 64 bit).

The following test code fails to compile:
Code:

program regression
    integer, parameter :: singI = selected_int_kind(9)
    integer(singI) :: y

    c_external foo 'foo'    (ref) : integer(singI) ! Explicit kind parameter -> Does not compile!
    !c_external foo 'foo'    (ref) : integer*4 ! Works
    !c_external foo 'foo'    (ref) : integer ! Works

    y = foo(2_singI)
    print *, y

end program

The error is:
Code:

[FTN95/x64 Ver. 8.10.0 Copyright (c) Silverfrost Ltd 1993-2017]

0005)     c_external foo 'foo'    (ref) : integer(singI)
*** Bad return type in C_EXTERNAL
0008)     y = foo(2_singI)
*** FOO is a SUBROUTINE so cannot be used as a FUNCTION
    2 ERRORS  [<REGRESSION> FTN95 v8.10.0]
*** Compilation failed

It seems like explicitly defined kinds do not work on C_EXTERNAL declarations properly.
If you comment in the second or third declaration instead the code compiles just fine. As far as I can see, http://www.silverfrost.com/ftn95-help/mixlan/callingc_c__fromftn95.aspx doesn't explicitly rule out explicit kind parameters (in fact it uses integer*4 in one of the examples), so I would consider this a bug(?).

Thanks in advance for commenting on the issue.
André
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 22, 2017 11:16 am    Post subject: Reply with quote

Rather strangely this does not reflect a regression in the usual sense.
Previously if you used anything other than INTEGER or INTEGER*x then you would get INTEGER anyway. In your case you wanted INTEGER so the result was correct but it would be incorrect for other INTEGER kinds.

Currently the compiler will accept INTEGER, INTEGER*x and INTEGER(7) but other kind values are not yet available in this context.
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