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 

INTERFACE not compiling due to ambiguity-but ok in GFortran

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
StamK



Joined: 12 Oct 2016
Posts: 21

PostPosted: Fri Apr 21, 2017 12:36 pm    Post subject: INTERFACE not compiling due to ambiguity-but ok in GFortran Reply with quote

Hi
I have the following test example. If compiled under silverfrost, it complains as follows:

*** This generic call to IUADD is ambiguous as both of the specifics IUADD1 and IUADD2 could match the arguments as supplied

In Gfortran it compiles and runs fine. Is this intended behaviour? It seems to me that they are different arguments. This is a simplified example to show the issue. Thanks


Code:

MODULE ADDITIONS
INTERFACE IUADD
  INTEGER*8 FUNCTION IUADD1(I1,I2)
    INTEGER*8 :: I1, I2
  END FUNCTION

  INTEGER*8 FUNCTION IUADD2(I1,I2)
    INTEGER*8      :: I1
    INTEGER*4      :: I2
  END FUNCTION
END INTERFACE

 
END MODULE

INTEGER*8 FUNCTION IUADD1(I1,I2)
    INTEGER*8 :: I1, I2
   
    IUADD1 = I1 + I2
  END FUNCTION

  INTEGER*8 FUNCTION IUADD2(I1,I2)
    INTEGER*8      :: I1
    INTEGER*4      :: I2
   
    IUADD2 = I1 + I2
  END FUNCTION


PROGRAM MAIN
  USE ADDITIONS
 
  INTEGER*8 K1, K2, KSUM
  INTEGER*4 L2
 
  K1 = 2
  K2 = 5
  L2 = 5
  KSUM = IUADD(K1, L2) ! this works
  KSUM = IUADD(K1, K2) ! this doesn't work in Silverforst (in GFortran yes)
  PRINT*,"KSUM = ",KSUM
END PROGRAM
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Apr 21, 2017 3:41 pm    Post subject: Reply with quote

I have made a note that this needs checking out.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Apr 21, 2017 4:00 pm    Post subject: Reply with quote

It seems to work OK for me. What version of FTN95 are you using?

It fails when using /size32 which is probably a bug. Are you using /size32 and do you need it? It is only needed in very unusual situations.
Back to top
View user's profile Send private message
StamK



Joined: 12 Oct 2016
Posts: 21

PostPosted: Sat Apr 22, 2017 11:37 am    Post subject: Reply with quote

I am indeed using /size32 (because I am using the size function a few times and I was getting many warnings because I am saving the output of the size as an INTEGER*4). So I will remove the /size32 for now. Thanks
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Apr 22, 2017 11:48 am    Post subject: Reply with quote

In the next release of FTN95 you will be able to add a KIND argument to the call of SIZE. Also for now you could opt to ignore particular warning messages by using a command line option.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit 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