Since C11, if a side effect on a scalar object is unsequenced relative to another side effect on the same scalar object, the behavior is undefined (see https://en.cppreference.com/c/language/eval_order). Although this code targets C89, where the order of volatile reads is merely unspecified, this is exactly what happens with the volatile cond_negate in the master branch, because a read of such a variable is a side effect. Clang 24 warns about it with -Wunsequenced regardless of the language standard:
$ cmake -B build -DCMAKE_C_COMPILER=clang-24
$ cmake --build build
[5/19] Building C object src/CMakeFiles/exhaustive_tests.dir/tests_exhaustive.c.o
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/tests_exhaustive.c:23:
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/secp256k1.c:27:
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/field_impl.h:14:
In file included from /home/hebasto/dev/secp256k1/secp256k1/src/field_5x52_impl.h:13:
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:116:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
116 | r0 = (r0 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:117:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
117 | r1 = (r1 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:118:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
118 | r2 = (r2 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:119:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
119 | r3 = (r3 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
/home/hebasto/dev/secp256k1/secp256k1/src/modinv64_impl.h:120:31: warning: unsequenced accesses to volatile qualified 'cond_negate' [-Wunsequenced]
120 | r4 = (r4 ^ cond_negate) - cond_negate;
| ~~~~~~~~~~~ ^
5 warnings generated.
<snip>
Avoid such behavior by separating the access to a volatile variable, which still prevents compilers from generating branching, non-constant-time machine code, from the actual use of its value in expressions where the evaluation order is unspecified.