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 crash (register-memory emit for MULSS)

 
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: 135

PostPosted: Wed Jul 04, 2018 1:20 pm    Post subject: scc crash (register-memory emit for MULSS) Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 04, 2018 1:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 135

PostPosted: Wed Jul 04, 2018 3:29 pm    Post subject: Reply with quote

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
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