[Nasm-bugs] [Bug 3392906] New: [regression] Missing comma syntax error not detected in db 1 2

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Tue Sep 5 20:43:12 PDT 2023


            Bug ID: 3392906
           Summary: [regression] Missing comma syntax error not detected
                    in  db 1 2
           Product: NASM
           Version: 2.16.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: pcordes at gmail.com
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: From OS distribution
      Generated by: Human
      Bug category: Unexpected or confusing behavior
    Breaks existing No

For example, this file
 db 1 2 
is a typo for 
 db 1, 2

NASM 2.16.01 (on x86-64 Arch Linux) silently assembles it to a single byte with
value 1
even with -W+all.  (I tried with flat binary, and -felf32, in case it's
dependent on output format.)

NASM 2.11.05 (on x86-64 Ubuntu) correctly rejects it with
foo.asm:1: error: comma expected after operand 1

It might be specific to db/dw/dd/etc list contexts, because  mov eax, 1 2  is
rejected with
foo.asm:1: error: comma, colon, decorator or end of line expected after operand
Also, foo: equ 4 5  is rejected with the same message.

In a longer list like where I first encountered it,
dst: dd 1,2 3,4,5,6,7,8,9,10

it assembles like dd 1,2,4,5,6,...  with the 2 3 element being treated exactly
like a 2.

These examples were all testing in files by themselves, with no command line
options, just simple flat-binary output.

If this is some intentional change (or unintended consequence of one) as part
of MASM syntax compatibility like 2 dup(0), I don't like it. It at least needs
a warning, if we can't just make parsing stricter.  Neither number is actually
getting treated as a repeat count here, though, even with numbers other than 1.

You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.

More information about the Nasm-bugs mailing list