From 3c23a1c944970c27401f0f24afe49d4303fe322d Mon Sep 17 00:00:00 2001 From: ampli Date: Thu, 30 May 2024 04:37:41 +0300 Subject: [PATCH] form_match_list(): Don't use _Atomic There is no need to ensure the "id" variable is incremented in an atomic way, because we don't care if two threads will use the same value. The crash that got debugged on commit 9f73b372 was due to another reason: not using "id" variable if it is 0. This has been fixed. Removing it gets rid of some small overhead, and also allows MSVC compilation. --- link-grammar/parse/fast-match.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/link-grammar/parse/fast-match.c b/link-grammar/parse/fast-match.c index d59d7dec1..a6e9d0e7f 100644 --- a/link-grammar/parse/fast-match.c +++ b/link-grammar/parse/fast-match.c @@ -595,8 +595,8 @@ form_match_list(fast_matcher_t *ctxt, int w, } #ifdef VERIFY_MATCH_LIST - static _Atomic(uint16_t) id = 0; - uint16_t lid = ++id; /* A local copy, for multi-threading support. */ + static uint16_t id = 0; + uint16_t lid = ++id; /* A stable local copy, for multi-threading support. */ #else const uint16_t lid = 0; #endif