Open
Description
Problem:
When running clang-tidy with the altera-struct-pack-align
there are a number of warnings about alignment and packing that are printed out. We should investigate the performance impact and memory impacts of following these recommendations.
Example output
/home/ec2-user/workspace/s2n-tls/utils/s2n_random.c:99:8: warning: accessing fields in struct 's2n_rand_state' is inefficient due to padding; only needs 89 bytes but is using 96 bytes [altera-struct-pack-align]
struct s2n_rand_state {
^
/home/ec2-user/workspace/s2n-tls/utils/s2n_random.c:99:8: note: use "__attribute__((packed))" to reduce the amount of padding applied to struct 's2n_rand_state'
/home/ec2-user/workspace/s2n-tls/utils/s2n_random.c:99:8: warning: accessing fields in struct 's2n_rand_state' is inefficient due to poor alignment; currently aligned to 8 bytes, but recommended alignment is 128 bytes [altera-struct-pack-align]
struct s2n_rand_state {
Solution:
I'm not totally certain of the interaction between packed
and alignment
. More investigation is needed.
Activity