[Nasm-bugs] [Bug 3392803] On recent NASM the %00 multi-line macro label feature is not supported

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Tue Aug 23 05:27:12 PDT 2022


https://bugzilla.nasm.us/show_bug.cgi?id=3392803

C. Masloch <pushbx at ulukai.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pushbx at ulukai.org

--- Comment #1 from C. Masloch <pushbx at ulukai.org> ---
Found the bug and the fix, the following patch includes both the fix and a
small debugging helper I used to diagnose the error (commented out).

~/proj/nasmpat$ git diff
diff --git a/asm/preproc.c b/asm/preproc.c
index 0ff2b518..3c147f1e 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -7285,9 +7285,11 @@ static Token *pp_tokline(void)
             if (mmac) {
                 const Token *t;
                 list_for_each(t, tline) {
-                    if (t->type == TOKEN_PREPROC_ID &&
+                    if (t->type == TOKEN_MMACRO_PARAM &&
                         !memcmp(t->text.a, "%00", 4))
                         mmac->capture_label = true;
+                    if (0) printf("t->type=%u t->text.a=%s
TOKEN_PREPROC_ID=%u\n",
+                      t->type, t->text.a, TOKEN_PREPROC_ID);
                 }
             }
         } else if (istk->conds && !emitting(istk->conds->state)) {

This is the relevant output of the printf before applying the fix:

$ ~/proj/nasmpat/nasm test.asm
...
t->type=294 t->text.a=%warning TOKEN_PREPROC_ID=294
t->type=32 t->text.a=  TOKEN_PREPROC_ID=294
t->type=295 t->text.a=%00 TOKEN_PREPROC_ID=294
test.asm:5: warning:  [-w+user]
test.asm:2: ... from macro `macro' defined here

The code in question is at
https://github.com/netwide-assembler/nasm/blob/3aebb20f123033dcd767f0abc46b18cbefed8091/asm/preproc.c#L7291

The token type enum is at
https://github.com/netwide-assembler/nasm/blob/3aebb20f123033dcd767f0abc46b18cbefed8091/include/nasm.h#L250

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


More information about the Nasm-bugs mailing list