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 

Problem with fgetc with SCC /64

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



Joined: 20 Nov 2006
Posts: 21

PostPosted: Thu May 02, 2019 3:57 pm    Post subject: Problem with fgetc with SCC /64 Reply with quote

It appears that the routine fgetc returns different values when compiled with the 64bit SCC compiler than under the 32bit SCC compiler.

A simple test using fputc and fgetc using the byte values 1 to 255; with the 32bit compiler it returns 1 to 255, but the 64 bit compiler returns 1 to 127 and then -128 to -1!

Confused
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1179

PostPosted: Fri May 03, 2019 2:38 am    Post subject: Reply with quote

The bug is in the fgetc code in salflibc64.dll. Ten instructions before the RET instruction of fgetc(), we see

Code:
000000001C009315  movsx       r15,byte ptr [rsp+20h]   ; sign bit got extended
000000001C00931B  mov         rax,r15

The corresponding code in the 32-bit salflibc.dll is
Code:
1001C5FA: 8A45EA               mov al, [ebp-16]
1001C5FD: 0FB6C0               movzx eax, al  ; zero extended to upper 24 bits of EAX

The return value from fgetc() is 0 to 0xFF, zero-extended to integer size, when there is no I/O error. One or more of bits 8-31 should be set only if an I/O error occurs.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri May 03, 2019 7:06 am    Post subject: Reply with quote

Thank you for the reports. It should be easy for us to fix.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri May 03, 2019 7:44 am    Post subject: Reply with quote

This has now been fixed but not in time for the 8.50 release.
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