NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: niccolo on August 16, 2021, 05:47:11 PM
-
Look at the following code:
segment .text
mov eax, x
mov ebx, y
...
segment .data
x DW 10
y DW 1
It has a bug: 'x' and 'y' are defined with 'dw' (16 bits) instead of 'dd' (32 bits). And they're assigned to 32 bits registers.
How can I make NASM print a warning in this case? If it's not possible, is there some way to guard against such bugs?
I've run nasm with the '-w+all' command line option, but it prints no warning.
(I'm new to Assembly.)
-
Oh my, I've found the following in the manual (https://www.nasm.us/xdoc/2.15.05/html/nasmdoc2.html#section-2.2.3):
2.2.3 NASM Doesn't Store Variable Types
NASM, by design, chooses not to remember the types of variables you declare.
So I guess that's it.
(Anyway, if anybody has tips on how not to trip on this, I'm all ears.)