View previous topic :: View next topic |
Author |
Message |
dbradly
Joined: 20 Nov 2006 Posts: 31
|
Posted: Thu May 02, 2019 3:57 pm Post subject: Problem with fgetc with SCC /64 |
|
|
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!
|
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1888
|
Posted: Fri May 03, 2019 2:38 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Fri May 03, 2019 7:06 am Post subject: |
|
|
Thank you for the reports. It should be easy for us to fix. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Fri May 03, 2019 7:44 am Post subject: |
|
|
This has now been fixed but not in time for the 8.50 release. |
|
Back to top |
|
|
|