diff --git a/fiat-bedrock2/src/curve25519_32.c b/fiat-bedrock2/src/curve25519_32.c index 095f7ec13cd..7980f9976c6 100644 --- a/fiat-bedrock2/src/curve25519_32.c +++ b/fiat-bedrock2/src/curve25519_32.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/curve25519_64.c b/fiat-bedrock2/src/curve25519_64.c index 029d75c6eb8..f0a04a39c3d 100644 --- a/fiat-bedrock2/src/curve25519_64.c +++ b/fiat-bedrock2/src/curve25519_64.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/curve25519_scalar_32.c b/fiat-bedrock2/src/curve25519_scalar_32.c index c80f5368ace..2cd3e69f278 100644 --- a/fiat-bedrock2/src/curve25519_scalar_32.c +++ b/fiat-bedrock2/src/curve25519_scalar_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/curve25519_scalar_64.c b/fiat-bedrock2/src/curve25519_scalar_64.c index 3ecc63804c5..11e750c761c 100644 --- a/fiat-bedrock2/src/curve25519_scalar_64.c +++ b/fiat-bedrock2/src/curve25519_scalar_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/curve25519_solinas_64.c b/fiat-bedrock2/src/curve25519_solinas_64.c index aa2992a0567..2db9c337280 100644 --- a/fiat-bedrock2/src/curve25519_solinas_64.c +++ b/fiat-bedrock2/src/curve25519_solinas_64.c @@ -14,8 +14,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p224_32.c b/fiat-bedrock2/src/p224_32.c index 897f659e5e1..49c3053f104 100644 --- a/fiat-bedrock2/src/p224_32.c +++ b/fiat-bedrock2/src/p224_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p224_64.c b/fiat-bedrock2/src/p224_64.c index 38bc5ac52cd..a4806cbfa79 100644 --- a/fiat-bedrock2/src/p224_64.c +++ b/fiat-bedrock2/src/p224_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p256_32.c b/fiat-bedrock2/src/p256_32.c index d5eba4a6eaf..2971d1b64b8 100644 --- a/fiat-bedrock2/src/p256_32.c +++ b/fiat-bedrock2/src/p256_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p256_64.c b/fiat-bedrock2/src/p256_64.c index 81a90013df8..c1291254ec7 100644 --- a/fiat-bedrock2/src/p256_64.c +++ b/fiat-bedrock2/src/p256_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p256_scalar_32.c b/fiat-bedrock2/src/p256_scalar_32.c index 3cf8e351bc6..a940f221b8a 100644 --- a/fiat-bedrock2/src/p256_scalar_32.c +++ b/fiat-bedrock2/src/p256_scalar_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p256_scalar_64.c b/fiat-bedrock2/src/p256_scalar_64.c index 27257d3f64b..ae52f855340 100644 --- a/fiat-bedrock2/src/p256_scalar_64.c +++ b/fiat-bedrock2/src/p256_scalar_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p384_32.c b/fiat-bedrock2/src/p384_32.c index 3e6e7ace8f2..ad9b89dde58 100644 --- a/fiat-bedrock2/src/p384_32.c +++ b/fiat-bedrock2/src/p384_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p384_64.c b/fiat-bedrock2/src/p384_64.c index 9d1a583c8a7..9b892900a50 100644 --- a/fiat-bedrock2/src/p384_64.c +++ b/fiat-bedrock2/src/p384_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p384_scalar_32.c b/fiat-bedrock2/src/p384_scalar_32.c index 6818e48022c..ba5732134a7 100644 --- a/fiat-bedrock2/src/p384_scalar_32.c +++ b/fiat-bedrock2/src/p384_scalar_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p384_scalar_64.c b/fiat-bedrock2/src/p384_scalar_64.c index 17e0787809f..587ab9a31de 100644 --- a/fiat-bedrock2/src/p384_scalar_64.c +++ b/fiat-bedrock2/src/p384_scalar_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p434_64.c b/fiat-bedrock2/src/p434_64.c index cfc59b6e5bf..e16dabd9ade 100644 --- a/fiat-bedrock2/src/p434_64.c +++ b/fiat-bedrock2/src/p434_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p448_solinas_64.c b/fiat-bedrock2/src/p448_solinas_64.c index bf66c5e5885..6ef691286c2 100644 --- a/fiat-bedrock2/src/p448_solinas_64.c +++ b/fiat-bedrock2/src/p448_solinas_64.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p521_32.c b/fiat-bedrock2/src/p521_32.c index e49a41815d2..1b5ff65aa94 100644 --- a/fiat-bedrock2/src/p521_32.c +++ b/fiat-bedrock2/src/p521_32.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/p521_64.c b/fiat-bedrock2/src/p521_64.c index 944ec35890d..58463b51efb 100644 --- a/fiat-bedrock2/src/p521_64.c +++ b/fiat-bedrock2/src/p521_64.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/poly1305_32.c b/fiat-bedrock2/src/poly1305_32.c index 3c95de17f12..4b8aa9d9bf8 100644 --- a/fiat-bedrock2/src/poly1305_32.c +++ b/fiat-bedrock2/src/poly1305_32.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/poly1305_64.c b/fiat-bedrock2/src/poly1305_64.c index 8093dfe6b2f..92ecb99a93e 100644 --- a/fiat-bedrock2/src/poly1305_64.c +++ b/fiat-bedrock2/src/poly1305_64.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/secp256k1_dettman_32.c b/fiat-bedrock2/src/secp256k1_dettman_32.c index 5975e4004b8..b9cd1b58080 100644 --- a/fiat-bedrock2/src/secp256k1_dettman_32.c +++ b/fiat-bedrock2/src/secp256k1_dettman_32.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/secp256k1_dettman_64.c b/fiat-bedrock2/src/secp256k1_dettman_64.c index c79f5f3bd18..dba31320ff7 100644 --- a/fiat-bedrock2/src/secp256k1_dettman_64.c +++ b/fiat-bedrock2/src/secp256k1_dettman_64.c @@ -19,8 +19,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/secp256k1_montgomery_32.c b/fiat-bedrock2/src/secp256k1_montgomery_32.c index fb265f7b5fa..5466d18011a 100644 --- a/fiat-bedrock2/src/secp256k1_montgomery_32.c +++ b/fiat-bedrock2/src/secp256k1_montgomery_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/secp256k1_montgomery_64.c b/fiat-bedrock2/src/secp256k1_montgomery_64.c index 11370a952b3..f69976b4faa 100644 --- a/fiat-bedrock2/src/secp256k1_montgomery_64.c +++ b/fiat-bedrock2/src/secp256k1_montgomery_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/secp256k1_montgomery_scalar_32.c b/fiat-bedrock2/src/secp256k1_montgomery_scalar_32.c index fd989beb845..e0f2b76f047 100644 --- a/fiat-bedrock2/src/secp256k1_montgomery_scalar_32.c +++ b/fiat-bedrock2/src/secp256k1_montgomery_scalar_32.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing. diff --git a/fiat-bedrock2/src/secp256k1_montgomery_scalar_64.c b/fiat-bedrock2/src/secp256k1_montgomery_scalar_64.c index c1c66951302..81e047417a7 100644 --- a/fiat-bedrock2/src/secp256k1_montgomery_scalar_64.c +++ b/fiat-bedrock2/src/secp256k1_montgomery_scalar_64.c @@ -24,8 +24,10 @@ static __attribute__((constructor)) void _br2_preconditions(void) { static_assert(~(intptr_t)0 == -(intptr_t)1, "two's complement"); assert(((void)"two's complement", ~(intptr_t)0 == -(intptr_t)1)); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const uintptr_t){1})); - assert(((void)"little-endian", 1 == *(unsigned char *)&(const intptr_t){1})); + uintptr_t u = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&u)); + intptr_t i = 1; + assert(((void)"little-endian", 1 == *(unsigned char *)&i)); } // We use memcpy to work around -fstrict-aliasing.