aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-09-04 14:09:37 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-09-04 14:09:37 -0700
commitff97eb6f7e716155c6afe6ffa961892660114165 (patch)
treeeb027896090ac86244567e5141afed3b2c20de97 /asm
parenta9ed8ced7c2459c04ae2a3ec438a7fe03604a350 (diff)
downloadnasm-ff97eb6f7e716155c6afe6ffa961892660114165.tar.gz
nasm-ff97eb6f7e716155c6afe6ffa961892660114165.tar.xz
nasm-ff97eb6f7e716155c6afe6ffa961892660114165.zip
preproc: don't loop on a variable that doesn't advance
When pasting and stripping %+ and whitespace tokens, we either need to set *nextp in the loop, or treat next as a separate variable and update *nextp after the loop finishes. This implements the second option. This fixes travis test "amx". Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'asm')
-rw-r--r--asm/preproc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index fbb0378b..b8fb6d23 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -4985,12 +4985,14 @@ static bool paste_tokens(Token **head, const struct concat_mask *m,
* we can end up having multiple %+ tokens in a row;
* just drop whem in that case.
*/
- while ((next = *nextp)) {
+ next = *nextp;
+ while (next) {
if (next->type == TOKEN_PASTE || next->type == TOKEN_WHITESPACE)
next = delete_Token(next);
else
break;
}
+ *nextp = next;
/*
* Nothing after? Just leave the existing token.