fix(libsodium): disable GCC static analyzer for libsodium#715
Merged
Conversation
mahavirj
reviewed
Mar 31, 2026
Member
|
@fhrbata please bump the component version LGTM! |
GCC's -fanalyzer flag, enabled by CONFIG_COMPILER_STATIC_ANALYZER=y, causes the compiler to hang indefinitely when analyzing libsodium's elliptic curve code (crypto_core/ed25519/ref10/ed25519_ref10.c). The -fanalyzer pass performs deep interprocedural static analysis, tracking symbolic state across all function calls within a translation unit. The complex field element arithmetic in ed25519_ref10.c (multiply, square, carry propagation) with many static helper functions visible in the same translation unit causes combinatorial state explosion in the analyzer, making GCC's cc1 process run at 100% CPU indefinitely. In a parallel build, this blocks all dependent steps (linking, binary generation) while independent steps finish normally, making the build appear stuck at "Completed 'bootloader'" — the last independent ninja target to complete. This is the same approach already used by ESP-IDF for mbedtls, wpa_supplicant, freertos, and other components with complex code that triggers pathological behavior in GCC's static analyzer. Closes espressif/esp-idf#18373 Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
cecedaa to
ce0dfeb
Compare
Collaborator
Author
Version bumped, thank you! |
mahavirj
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-fno-analyzercompile option to the libsodium component whenCONFIG_COMPILER_STATIC_ANALYZERis enabled with GCC-fanalyzercauses the compiler to hang indefinitely on libsodium's elliptic curve code (ed25519_ref10.c) due to combinatorial state explosion in the interprocedural analysisCloses espressif/esp-idf#18373
Test plan
CONFIG_COMPILER_STATIC_ANALYZER=yandespressif/libsodiumdependency hangs indefinitely (GCC'scc1stuck at 100% CPU oned25519_ref10.c)ed25519_ref10.csuccessfully and the build completes