View previous topic :: View next topic |
Author |
Message |
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Wed Jul 04, 2018 1:20 pm Post subject: scc crash (register-memory emit for MULSS) |
|
|
The following code causes scc to crash if compiled using scc with option /64 set and USE_GETTICKCOUNT defined. The code is given by
Code: |
#include <windows.h>
int myProc(int myParm)
{
#ifdef USE_GETTICKCOUNT
static float lastTime = GetTickCount() * 0.001f;
#else
static float lastTime=0.001f;
#endif
return 0;
}
|
and it is named "scc_crash.cpp". Executing command
Code: |
scc scc_crash.cpp /64 /DEFINE USE_GETTICKCOUNT
|
makes scc crash and display the lines
Code: |
[Silverfrost SCC/WIN32 Ver 4.20 Copyright (c) Silverfrost Ltd 2018]
0006 static float lastTime = GetTickCount() * 0.001f;
COMMENT - This initialisation will be performed once only
WARNING - 'lastTime' has been given a value, but never used
0003 int myProc(int myParm)
WARNING - 'myParm' has not been used
0011 }
*** Failed to do register-memory emit for MULSS at 8
*** Failed to do memory-register emit for MOVSS at 9
2 ERRORS [<SCC_CRASH> SCC/WIN32 Ver 4.20]
*** Compilation failed
|
An object file SCC_CRASH.OBJ is generated, however, its length is 0.
An error file for the crash has been created consisting of the lines
Code: |
Runtime error from program:c:\win32app\silverfrost_8.30\ftn95\scc.exe
Breakpoint
Breakpoint at address 004a8d45
004a8aed amd_do_type_conversion(<ptr>struct─tree_record) [+0258]
004a0c14 AmdCodeGenerator(<ref>struct─tree_ptr) [+4321]
004a7418 amd_do_times(<ptr>struct─tree_record) [+0044]
004a0c14 AmdCodeGenerator(<ref>struct─tree_ptr) [+4321]
004a7a82 amd_do_equals(<ptr>struct─tree_record) [+0073]
004a0c14 AmdCodeGenerator(<ref>struct─tree_ptr) [+4321] [recur= 2]
004a837b amd_do_function_top(<ptr>struct─tree_record) [+0309]
004a0c14 AmdCodeGenerator(<ref>struct─tree_ptr) [+4321]
0048aaf6 code_generator(<ref&÷w>Ysu
eax=0ae09668 ebx=00000005 ecx=00000019
edx=00000007 esi=0ae09688 edi=0000004b
ebp=0377e84c esp=0377e810 IOPL=0
ds=002b es=002b fs=0053
gs=002b cs=0023 ss=002b
flgs=00000297 [CA EP NZ NS DN NV]
004a8d45 int 3
004a8d46 jmp 4a8e6c
004a8d4b push 0xf0f0f0f0
|
. Each of the commands
Code: |
scc scc_crash.cpp /64
scc scc_crash.cpp /DEFINE USE_GETTICKCOUNT
scc scc_crash.cpp
|
worked successfully and created an object file SCC_CRASH.OBJ with postive length. This makes me suspect that GetTickCount causes problems for the 64 bit compile.
Regards,
Dietmar |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Jul 04, 2018 1:59 pm Post subject: |
|
|
Dietmar
A work-around is to cast the return DWORD value of GetTickCount to an int...
Code: | static float lastTime = (int)GetTickCount() * 0.001f;
|
The code seems strange to me since I assume the call is made only once when the application is loaded. |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Wed Jul 04, 2018 3:29 pm Post subject: |
|
|
Paul,
thanks for the work-around which made the "critical" sample be compiled successfully. I know that the static declaration had better been moved outside the function. I had given it a chance but the result was the same. Nevertheless this should not matter ... as you said this code (initializing lastTime) should be made only once.
Regards,
Dietmar |
|
Back to top |
|
|
|