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
Building with GCC + ASAN / UBSAN appears to treat certain checks as errors.
With ASAN, we have -Werror=stringop-truncation errors like so:
src/app/fdctl/config.c: In function 'fdctl_cfg_from_env':
src/app/fdctl/config.c:473:5: error: '__builtin_strncpy' output may be truncated copying 15 bytes from a string of length 255 [-Werror=stringop-truncation]
473 | strncpy( config->tiles.net.interface,
| ^
src/app/fdctl/config.c:490:3: error: '__builtin_strncpy' output may be truncated copying 39 bytes from a string of length 64 [-Werror=stringop-truncation]
490 | strncpy( config->hostname, utsname.nodename, sizeof(config->hostname) );
| ^
cc1: all warnings being treated as errors
make: *** [config/everything.mk:308: build/test-vectors/obj/app/fdctl/config.o] Error 1
UBSAN sees sign-conversion and stringop-overflow checks triggered like so:
src/ballet/base58/../../util/spad/../bits/fd_bits.h:681:50: error: writing 4 bytes into a region of size 0 [-Werror=stringop-overflow=]
681 | (__extension__({ T _fd_store_tmp = (val); (T *)memcpy( (T *)(dst), &_fd_store_tmp, sizeof(T) ); }))
| ^~~~~~
src/ballet/base58/fd_base58_tmpl.c:380:5: note: in expansion of macro 'FD_STORE'
380 | FD_STORE( uint, &out_as_uint[ i ], fd_uint_bswap( (uint)binary[ i ] ) );
| ^~~~~~~~
src/ballet/pack/fd_pack.c: In function 'fd_pack_clear_all':
src/ballet/pack/fd_pack.c:817:21: error: conversion to 'ulong' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
817 | ulong __idx = (idx); \
| ^
src/ballet/pack/fd_pack.c:1783:38: note: in expansion of macro 'ACCT_IDX_TO_PTR'
1783 | fd_acct_addr_t penalty_acct = *ACCT_IDX_TO_PTR( FD_ORD_TXN_ROOT_PENALTY_ACCT_IDX( del->root ) );
| ^~~~~~~~~~~~~~~
src/ballet/pack/fd_pack.c: In function 'fd_pack_delete_transaction':
src/ballet/pack/fd_pack.c:817:21: error: conversion to 'ulong' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
817 | ulong __idx = (idx); \
| ^
src/ballet/pack/fd_pack.c:1834:38: note: in expansion of macro 'ACCT_IDX_TO_PTR'
1834 | fd_acct_addr_t penalty_acct = *ACCT_IDX_TO_PTR( FD_ORD_TXN_ROOT_PENALTY_ACCT_IDX( root_idx ) );
The text was updated successfully, but these errors were encountered:
ravyu-jump
changed the title
build errors with GCC + ASAN/UBSAN
Build errors with GCC + ASAN/UBSAN
Dec 30, 2024
I looked at a couple of them and they seem to be compiler bugs.
It seems like GCC warnings change unpredictably with every major release and certain compile flags.
stringop-overflow, stringop-truncation, and maybe-uninitialized produce frequent false positives.
Maybe we should move these unreliable checks to with-extra-brutality.mk so they are not enabled by default.
Building with GCC + ASAN / UBSAN appears to treat certain checks as errors.
With ASAN, we have
-Werror=stringop-truncation
errors like so:UBSAN sees
sign-conversion
andstringop-overflow
checks triggered like so:The text was updated successfully, but these errors were encountered: