wolfgang kern
2024-01-30 09:14:48 UTC
Hi.
I am using a slightly modified GCC 3.2.3
to generate x64 code, and using PDPCLIB
and running under Linux x64.
...I am using a slightly modified GCC 3.2.3
to generate x64 code, and using PDPCLIB
and running under Linux x64.
...
printf("as negative is %x\n", p[-1]);
movl $4294967295, %eax
addq -64(%rbp), %rax
movsbl (%rax),%esi
movl $LC445, %edi
movb $0, %al
call _printf
That first instruction - the movl - has
negative 1 as an unsigned value.
of course because it's just the lower part of RAXmovl $4294967295, %eax
addq -64(%rbp), %rax
movsbl (%rax),%esi
movl $LC445, %edi
movb $0, %al
call _printf
That first instruction - the movl - has
negative 1 as an unsigned value.
where the upper part become zeroed by a move to EAX.
I tried manually changing the generated assembler
to $-1 but the result appears to be the
same (I may have stuffed up the test).
you have to make RAX -1to $-1 but the result appears to be the
same (I may have stuffed up the test).
XOR RAX,RAX
DEC RAX
but what's wrong with: DEC instead of ADD -1
__
wolfgang