You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Release build with AVM_WARNINGS_ARE_ERRORS=ON fails on an unused variable in module.h #2448
Found while reviewing #2357; pre-existing (module.h is not changed by #2357). Configuring with -DCMAKE_BUILD_TYPE=Release -DAVM_WARNINGS_ARE_ERRORS=ON does not build, with gcc 15.2 and clang 21.1 alike:
The error repeats for every translation unit that includes module.h. Debug builds, and the CI builds (which do not set CMAKE_BUILD_TYPE), are fine.
Cause: module_get_fun_arity_old_index_uniq (src/libAtomVM/module.h:364-376) reads funs_count only to check it in assert(fun_index < funs_count). A Release build defines NDEBUG, the assert disappears, and the variable becomes unused in a static inline function in a header.
Fix: mark it with UNUSED(funs_count) after the assert, or keep the read inside the assert (assert(fun_index < (int) READ_32_UNALIGNED(table_data + 8))), and add a Release + AVM_WARNINGS_ARE_ERRORS=ON configuration to CI so that this cannot come back.
Activity