See #1001.
Try to revert the lines in tests.c to see the error message in action.
See #1001.
Try to revert the lines in tests.c to see the error message in action.
See #1001.
ACK be8ff3a02aeff87c60d49883a1b2afa8b2999bbe. Verified by introducing some non-constant expressions and seeing compilation fail.
ACK be8ff3a02aeff87c60d49883a1b2afa8b2999bbe
Tested with clang 13.0.0 using the following (non C-90 conform) patch:
diff --git a/src/group_impl.h b/src/group_impl.h
index 44d9843..31e1820 100644
--- a/src/group_impl.h
+++ b/src/group_impl.h
@@ -140,7 +140,8 @@ static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a) {
secp256k1_ge_verify(a);
*r = *a;
secp256k1_fe_normalize_weak(&r->y);
- secp256k1_fe_negate(&r->y, &r->y, 1);
+ int one = 1;
+ secp256k1_fe_negate(&r->y, &r->y, one);
secp256k1_ge_verify(r);
}
@@ -372,7 +373,8 @@ static SECP256K1_INLINE void secp256k1_gej_double(secp256k1_gej *r, const secp25
secp256k1_fe_mul(&r->z, &a->z, &a->y); /* Z3 = Y1*Z1 (1) */
secp256k1_fe_sqr(&s, &a->y); /* S = Y1^2 (1) */
secp256k1_fe_sqr(&l, &a->x); /* L = X1^2 (1) */
- secp256k1_fe_mul_int(&l, 3); /* L = 3*X1^2 (3) */
+ int three = 3;
+ secp256k1_fe_mul_int(&l, three); /* L = 3*X1^2 (3) */
secp256k1_fe_half(&l); /* L = 3/2*X1^2 (2) */
secp256k1_fe_negate(&t, &s, 1); /* T = -S (2) */
secp256k1_fe_mul(&t, &t, &a->x); /* T = -X1*S (1) */
The compilation error messages are straight to the point (even without the macro expansions shown after):
src/group_impl.h:144:39: error: expression is not an integer constant expression
secp256k1_fe_negate(&r->y, &r->y, one);
^~~
......
......
src/group_impl.h:377:30: error: expression is not an integer constant expression
secp256k1_fe_mul_int(&l, three); /* L = 3*X1^2 (3) */
^~~~~
.....
.....