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 

Scc 64 bit: /debug error + erroneous warnings

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



Joined: 03 Jun 2013
Posts: 239

PostPosted: Wed Jul 15, 2020 9:46 am    Post subject: Scc 64 bit: /debug error + erroneous warnings Reply with quote

In many Fortran apps we make calls to C/C++ and hence make use of scc 64 bit.

Compiling the following C code for 64 bit (named wrong_warning.cpp) produces erroneous warnings and results in an error if specifiying scc option /debug:

Code:

#include <stdio.h>
#include <string.h>
int main(int argc,char *argv[]) {
    int j=0;
    printf("argc=%d\n",argc);
    if (argc > 1) {
      printf("argv[1]=%s\n",argv[1]);
    } else {
      printf("No parameter specified ... exiting\n");
      return 1;
    }
    if( strcmp(argv[1],"point") == 0 )
      j=1;
    else if(strcmp(argv[1],"polygon") == 0 )
      j=2;
    else
      j=3;
    printf("Case=%d\n",j);
    return 0;
}

Command
Code:
scc wrong_warning.cpp /link /64

displays warnings
Code:
[Silverfrost SCC/WIN32 Ver 4.31 Copyright (c) Silverfrost Ltd 2
   0009         printf("No parameter specified ... exiting\n");
WARNING - This statement will never be executed
   0012       if( strcmp(argv[1],"point") == 0 )
WARNING - This statement will never be executed
   0014       else if(strcmp(argv[1],"polygon") == 0 )
WARNING - This statement will never be executed
   0017         j=3;
WARNING - This statement will never be executed
    NO ERRORS, 4 WARNINGS  [<WRONG_WARNING> SCC/WIN32 Ver 4.31]
[SLINK64 v2.14, Copyright (c) Silverfrost Ltd. 2015-2020]
Loading c:\ds\samples\salford_8.40\lgotemp@.OBJ
Creating executable file WRONG_WARNING.EXE

which are not true. This may be shown via commands
Code:
wrong_warning.exe
wrong_warning.exe point
wrong_warning.exe point1

Moreover, adding option /debug to the scc command mentioned above in order to produce a 64 bit debuggable exe file results in an error and does not create an exe file:
Code:
c:\ds\samples\salford_8.40>scc wrong_warning.cpp /link /64 /debug
[Silverfrost SCC/WIN32 Ver 4.31 Copyright (c) Silverfrost Ltd 2020]
   0020   }
*** Attempt to emit 32-bit instruction in /64 mode
    1 ERRORS  [<WRONG_WARNING> SCC/WIN32 Ver 4.31]
*** Compilation failed

If omitting option /64 and thus creating the corresponding 32 bit versions these phenomenons do not occur.

Regards,
Dietmar
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 15, 2020 11:08 am    Post subject: Reply with quote

Dietmar

Thank you for the feedback. However, 64 bit SCC still has the status of being unsupported. These issues are known and will need to be fixed before changing the status of SCC. In the meantime it may be possible to fix some bugs if they are blocking a user's progress.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1412

PostPosted: Wed Jul 15, 2020 12:06 pm    Post subject: Reply with quote

Since Silverfrost use a proprietary format for 64-bit OBJ files and static libraries, users face an obstacle when they wish to use a C subroutine with their Fortran code and SCC-64 runs into a bug.

When I was in a similar situation, I used the Microsoft C compiler to produce a DLL instead of an OBJ or a static library, and linked the FTN95-compiled 64-bit code with that DLL.
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 239

PostPosted: Fri Jul 17, 2020 12:56 pm    Post subject: Reply with quote

mecej4,

many thanks for your hint. I've tried to make use of it and could generate a ftn95 source from which I called into a C/CPP Dll both being created with the debug flag set. The executable worked as expected, but unfortunately I was not able to debug into the function implemented in the dll via sdbg64.

Here is the code:

Ftn95 file sample1.for:
Code:

      C_EXTERNAL MYSUM 'MYSUM' (REF,REF):INTEGER*4     
      integer*4 j,s1,s2
      s1=1
      s2=2
#IF _WIN64
      write(*,*) '64 Bit App'
#ENDIF
      j=MYSUM(s1,s2)
      write(*,*) 'j=MYSUM(s1,s2)=',j
      END


C/CPP file sample1_dll.cpp:
Code:

#include <windows.h>
#include <stdio.h>

extern "C" __declspec(dllexport) int MYSUM (int *a, int *b)
{
    int c;
    c=*a+*b;
    printf("MYSUM contained in dll sample1_dll.dll\n");
    return c ;
}


Commands to build
Code:

ftn95 sample1.for /debug /CFPP /64
cl sample1_dll.cpp /LD /Zi
slink64 sample1.lnk
where file sample1.lnk is given by
Code:

lo sample1
lo sample1_dll.dll
file sample1.exe

and where cl is the 64 bit Microsoft C compiler. I may debug sample1.exe via command
Code:
sdbg64 sample1.exe

and via F8 I may step up to function call MYSUM. Pressing F7 to step into the function does not work and steps over the function.

I thought maybe there would be a chance to step into it.

Version info:
Code:

[FTN95/x64 Ver. 8.63.0 Copyright (c) Silverfrost Ltd 1993-2020]
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.762 for x64

Regards,
Dietmar
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