Description: macro !IF: fix !NOT evaluation on architectures where strcmp()
 does not return 0/1 for unequal strings
 The !IF condition evaluator computed the negation of a boolean operand as
 .
   bool b = strcmp (operand, "0") ^ (negations & 1);
 .
 i.e. it XORed strcmp()'s raw return value with the parity of the !NOT
 operators.  C only guarantees the sign of strcmp()'s result, not its
 magnitude, and some implementations return a value whose low bit is zero
 (glibc's aarch64 strcmp() returns 128 for any mismatch).  There, the XOR
 produced a non-zero value for an odd number of negations, so "!NOT 1"
 wrongly evaluated to true (and "!NOT 0" to false), which made the
 language/commands/define.at logical-operator test fail on arm64.
 .
 Compare the result explicitly against zero so that a proper boolean is
 obtained.  The behaviour of the former code on architectures where
 strcmp() happens to return 1 (or any odd value) is unchanged.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: vendor
Forwarded: no
Last-Update: 2026-10-20
---
--- pspp-2.0.1.orig/src/language/lexer/macro.c
+++ pspp-2.0.1/src/language/lexer/macro.c
@@ -1478,7 +1478,7 @@ macro_evaluate_not (const struct macro_e
       return operand;
     }
 
-  bool b = strcmp (operand, "0") ^ (negations & 1);
+  bool b = (strcmp (operand, "0") != 0) ^ (negations & 1);
   free (operand);
   *tokens = p;
   return xstrdup (b ? "1" : "0");
