diff --git a/c/blake3.c b/c/blake3.c index 9998f75c7..9114df08f 100644 --- a/c/blake3.c +++ b/c/blake3.c @@ -345,7 +345,12 @@ INLINE void compress_subtree_to_parent_node( // compress_subtree_wide() returns more than 2 chaining values. Condense // them into 2 by forming parent nodes repeatedly. uint8_t out_array[MAX_SIMD_DEGREE_OR_2 * BLAKE3_OUT_LEN / 2]; - while (num_cvs > 2) { + // The second half of this loop condition, num_cvs <= MAX_SIMD_DEGREE_OR_2, + // is always true. compress_subtree_wide() will never return more than + // MAX_SIMD_DEGREE_OR_2 items. But GCC isn't aware of that fact, and on + // platforms where MAX_SIMD_DEGREE_OR_2 == 2, it emits spurious warnings + // here. The second half of this loop condition silences those warnings. + while (num_cvs > 2 && num_cvs <= MAX_SIMD_DEGREE_OR_2) { num_cvs = compress_parents_parallel(cv_array, num_cvs, key, flags, out_array); memcpy(cv_array, out_array, num_cvs * BLAKE3_OUT_LEN);