Problem
Building with GCC 13+ fails with alignment errors in blake2.h:
blake2.h:101:5: error: size of array element is not a multiple of its alignment
101 | blake2s_state S[8][1];
| ^~~~~~~~~~~~~
blake2.h:102:5: error: size of array element is not a multiple of its alignment
102 | blake2s_state R[1];
Cause
GCC 13 is stricter about alignment constraints. The blake2s_state and blake2b_state structs are declared with ALIGN(64) but their sizes are not multiples of 64 bytes. When these aligned structs are used in arrays inside #pragma pack(push, 1), GCC 13 rejects this as invalid.
Solution
Two changes needed:
- Remove
ALIGN(64) from blake2s_state and blake2b_state struct definitions (not needed for reference implementation)
- Move
#pragma pack(pop) before the parallel state structures (blake2sp_state, blake2bp_state) which contain arrays of the aligned types
Environment
- GCC 13.3.0 (Ubuntu 24.04)
- Affects clean builds from source
Related
Problem
Building with GCC 13+ fails with alignment errors in
blake2.h:Cause
GCC 13 is stricter about alignment constraints. The
blake2s_stateandblake2b_statestructs are declared withALIGN(64)but their sizes are not multiples of 64 bytes. When these aligned structs are used in arrays inside#pragma pack(push, 1), GCC 13 rejects this as invalid.Solution
Two changes needed:
ALIGN(64)fromblake2s_stateandblake2b_statestruct definitions (not needed for reference implementation)#pragma pack(pop)before the parallel state structures (blake2sp_state,blake2bp_state) which contain arrays of the aligned typesEnvironment
Related