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:
#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
scc wrong_warning.cpp /link /64
displays warnings
[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
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:
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