haskell-crypto / cryptonite

lowlevel set of cryptographic primitives for haskell
Other
226 stars 139 forks source link

Unable to build on FreeBSD aarch64: cbits/decaf/p448/f_generic.c:56:8: error: loop not unrolled #350

Closed MikaelUrankar closed 1 year ago

MikaelUrankar commented 3 years ago

I have the following error when building 'stack' which uses cryptonite 0.29 on FreeBSD aarch64, clang 12:

cbits/decaf/p448/f_generic.c:56:8: error:
     warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
   |
56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
   |        ^
mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
       ^

cbits/decaf/p448/f_field.h:54:38: error:
     note: expanded from macro 'cryptonite_gf_deserialize'
   |
54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
   |                                      ^
#define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize

It builds fine if I use this patch:

--- cbits/decaf/include/word.h      2019-09-08 02:46:48.000000000 +0200
+++ cbits/decaf/include/word.h      2021-09-24 08:33:56.054654000 +0200
@@ -238,7 +238,7 @@ malloc_vector(size_t size) {
 /* PERF: vectorize vs unroll */
 #ifdef __clang__
 #if 100*__clang_major__ + __clang_minor__ > 305
-#define UNROLL _Pragma("clang loop unroll(full)")
+//#define UNROLL _Pragma("clang loop unroll(full)")
 #endif
 #endif

Any suggestions?

tfausak commented 2 years ago

See #352.

arrowd commented 2 years ago

The problem is still present in 0.30