From: Peter Johnson Date: Wed, 21 May 2003 00:39:24 +0000 (-0000) Subject: Fix crash in "no non-local label before `%s'" warning (misuse of s.tok). X-Git-Tag: v0.2.2~3^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e60fe7b21cf1f86fa3d50597628e7adf61ad6245;p=yasm Fix crash in "no non-local label before `%s'" warning (misuse of s.tok). Add testcase for this warning while we're at it. svn path=/trunk/yasm/; revision=952 --- diff --git a/modules/parsers/nasm/nasm-token.re b/modules/parsers/nasm/nasm-token.re index 81f1759a..b8bfc2b8 100644 --- a/modules/parsers/nasm/nasm-token.re +++ b/modules/parsers/nasm/nasm-token.re @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -RCSID("$IdPath: yasm/modules/parsers/nasm/nasm-token.re,v 1.20 2003/03/31 05:36:30 peter Exp $"); +RCSID("$IdPath$"); #define YASM_LIB_INTERNAL #include @@ -356,9 +356,10 @@ scan: yylval.str_val = yasm__xstrndup(s.tok, TOKLEN); RETURN(ID); } else if (!nasm_parser_locallabel_base) { - yasm__warning(YASM_WARN_GENERAL, cur_lindex, - N_("no non-local label before `%s'"), s.tok[0]); yylval.str_val = yasm__xstrndup(s.tok, TOKLEN); + yasm__warning(YASM_WARN_GENERAL, cur_lindex, + N_("no non-local label before `%s'"), + yylval.str_val); } else { len = TOKLEN + nasm_parser_locallabel_base_len; yylval.str_val = yasm_xmalloc(len + 1); diff --git a/modules/parsers/nasm/tests/Makefile.inc b/modules/parsers/nasm/tests/Makefile.inc index b161c203..724aac6c 100644 --- a/modules/parsers/nasm/tests/Makefile.inc +++ b/modules/parsers/nasm/tests/Makefile.inc @@ -10,4 +10,7 @@ EXTRA_DIST += \ modules/parsers/nasm/tests/equlocal.hex \ modules/parsers/nasm/tests/newsect.asm \ modules/parsers/nasm/tests/newsect.errwarn \ - modules/parsers/nasm/tests/newsect.hex + modules/parsers/nasm/tests/newsect.hex \ + modules/parsers/nasm/tests/prevlocalwarn.asm \ + modules/parsers/nasm/tests/prevlocalwarn.errwarn \ + modules/parsers/nasm/tests/prevlocalwarn.hex diff --git a/modules/parsers/nasm/tests/prevlocalwarn.asm b/modules/parsers/nasm/tests/prevlocalwarn.asm new file mode 100644 index 00000000..2d068b3a --- /dev/null +++ b/modules/parsers/nasm/tests/prevlocalwarn.asm @@ -0,0 +1,5 @@ +[bits 16] +[section .text] + +.local: + xor ax, ax diff --git a/modules/parsers/nasm/tests/prevlocalwarn.errwarn b/modules/parsers/nasm/tests/prevlocalwarn.errwarn new file mode 100644 index 00000000..c523eaef --- /dev/null +++ b/modules/parsers/nasm/tests/prevlocalwarn.errwarn @@ -0,0 +1 @@ +-:4: warning: no non-local label before `.local' diff --git a/modules/parsers/nasm/tests/prevlocalwarn.hex b/modules/parsers/nasm/tests/prevlocalwarn.hex new file mode 100644 index 00000000..53f450a3 --- /dev/null +++ b/modules/parsers/nasm/tests/prevlocalwarn.hex @@ -0,0 +1,2 @@ +31 +c0