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
Tested with clang 13.0.0 using the following (non C-90 conform) patch:
0diff --git a/src/group_impl.h b/src/group_impl.h
1index 44d9843..31e1820 100644
2--- a/src/group_impl.h
3+++ b/src/group_impl.h
4@@ -140,7 +140,8 @@ static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a) {
5 secp256k1_ge_verify(a);
6 *r = *a;
7 secp256k1_fe_normalize_weak(&r->y);
8- secp256k1_fe_negate(&r->y, &r->y, 1);
9+ int one = 1;
10+ secp256k1_fe_negate(&r->y, &r->y, one);
11 secp256k1_ge_verify(r);
12 }
13
14@@ -372,7 +373,8 @@ static SECP256K1_INLINE void secp256k1_gej_double(secp256k1_gej *r, const secp25
15 secp256k1_fe_mul(&r->z, &a->z, &a->y); /* Z3 = Y1*Z1 (1) */
16 secp256k1_fe_sqr(&s, &a->y); /* S = Y1^2 (1) */
17 secp256k1_fe_sqr(&l, &a->x); /* L = X1^2 (1) */
18- secp256k1_fe_mul_int(&l, 3); /* L = 3*X1^2 (3) */
19+ int three = 3;
20+ secp256k1_fe_mul_int(&l, three); /* L = 3*X1^2 (3) */
21 secp256k1_fe_half(&l); /* L = 3/2*X1^2 (2) */
22 secp256k1_fe_negate(&t, &s, 1); /* T = -S (2) */
23 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):
0src/group_impl.h:144:39: error: expression is not an integer constant expression
1 secp256k1_fe_negate(&r->y, &r->y, one);
2 ^~~
3......
4......
5src/group_impl.h:377:30: error: expression is not an integer constant expression
6 secp256k1_fe_mul_int(&l, three); /* L = 3*X1^2 (3) */
7 ^~~~~
8.....
9.....
Labels
assurance