Skip to content

Commit d167b3d

Browse files
mebeimcyrillos
authored andcommitted
Fix wrong size calculation for "Dx ?" larger than DB
The size calculation done in len_extops() (called by insn_size()) for EOT_DB_RESERVE (i.e. uninitialized storage "?" token) does not take into account the element size (e->elem), thus calculating a wrong size for any Dx larger than DB (DW, DQ, etc). The bug is silent, but it makes NASM error out if a "Dx ?" (larger than DB) is followed by any label because the label offset gets mismatched in the final code generation stage: $ cat test.asm [section .bss] DW ? x: $ nasm test.asm test.asm:3: error: label `x' changed during code generation [-w+error=label-redef-late] See also: https://stackoverflow.com/q/70012188/3889449 Signed-off-by: Marco Bonelli <marco@mebeim.net> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
1 parent 00c6490 commit d167b3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

asm/assemble.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static int64_t len_extops(const extop *e)
11111111
break;
11121112

11131113
case EOT_DB_RESERVE:
1114-
isize += e->dup;
1114+
isize += e->dup * e->elem;
11151115
break;
11161116
}
11171117

0 commit comments

Comments
 (0)