flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Bug ? (value out of range) |
Author |
|
ouadji 05 Nov 2011, 22:50
in both cases "use32" in first case: value out of range, does not compile ... 100% ok. in second case: does compile without problem too. (???) |
|||
05 Nov 2011, 22:50 |
|
Tomasz Grysztar 05 Nov 2011, 22:58
This is one of the side-effects of fasm's flaw that it calculates on 64-bit numbers instead of 65-bit, as it really should. 18446744073709551615 is the same as 0FFFFFFFFFFFFFFFFh, which fasm interpretes as -1. And -1 does fit into double word (as 0FFFFFFFFh). See the link for all the details, including some background on TASM, too.
|
|||
05 Nov 2011, 22:58 |
|
revolution 05 Nov 2011, 23:43
ouadji: Currently in fasm:
- addition and subtraction will never overflow. - Multiplication can overflow. |
|||
05 Nov 2011, 23:43 |
|
ouadji 05 Nov 2011, 23:48
addition (and subtraction) will never overflow in this case, why this: mov eax, 0xFFFFFFFF + 1 ;---> value out of range |
|||
05 Nov 2011, 23:48 |
|
revolution 05 Nov 2011, 23:52
ouadji wrote:
|
|||
05 Nov 2011, 23:52 |
|
revolution 05 Nov 2011, 23:54
BTW: In case you are curious here is the original topic about 65 bit processing. A small example of it in action.
http://board.flatassembler.net/topic.php?p=27758#27758 |
|||
05 Nov 2011, 23:54 |
|
ouadji 06 Nov 2011, 00:01
Quote: It is not the addition that is overflowing. Code: mov ebx, $1'FFFF'FFFF ;33bits ==> "value out of range" |
|||
06 Nov 2011, 00:01 |
|
revolution 06 Nov 2011, 00:06
To test overflow use something like this:
Code: x=1 shl 63 + 1 shl 63 ;does not overflow y=0 - 1 shl 63 - 1 shl 63 ;does not overflow z=1 shl 63 * 1 shl 63 ;die |
|||
06 Nov 2011, 00:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.