From: Peter Johnson Date: Sat, 3 Feb 2007 23:52:44 +0000 (-0000) Subject: Fix handling of times 0 <...>. X-Git-Tag: v0.6.0~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95e57a41e47c793835cbf66e37e434bcf61b6f74;p=yasm Fix handling of times 0 <...>. svn path=/trunk/yasm/; revision=1750 --- diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index 27ccfdc9..59c93b28 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -167,7 +167,16 @@ yasm_bc_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc) else if (val.rel) yasm_error_set(YASM_ERROR_NOT_ABSOLUTE, N_("multiple expression not absolute")); - bc->multiple = val.abs; + /* Finalize creates NULL output if value=0, but bc->multiple is NULL + * if value=1 (this difference is to make the common case small). + * However, this means we need to set bc->multiple explicitly to 0 + * here if val.abs is NULL. + */ + if (val.abs) + bc->multiple = val.abs; + else + bc->multiple = yasm_expr_create_ident( + yasm_expr_int(yasm_intnum_create_uint(0)), bc->line); } } diff --git a/libyasm/tests/times0.asm b/libyasm/tests/times0.asm new file mode 100644 index 00000000..ea642d79 --- /dev/null +++ b/libyasm/tests/times0.asm @@ -0,0 +1 @@ +times 0 db 1 diff --git a/libyasm/tests/times0.hex b/libyasm/tests/times0.hex new file mode 100644 index 00000000..e69de29b