Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning with unaligned memory access when building in GCC version (9.1.0) #1

Open
ramonhpr opened this issue Oct 3, 2019 · 0 comments

Comments

@ramonhpr
Copy link
Contributor

ramonhpr commented Oct 3, 2019

Problems with unaligned memory access detected by GCC newer version (9.1.0, on arch-linux)
https://www.kernel.org/doc/Documentation/unaligned-memory-access.txt

tools/sniffer.c: In function ‘decode_raw’:
tools/sniffer.c:62:17: error: taking address of packed member of ‘struct nrf24_ll_keepalive’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
   62 |   nrf24_mac2str(&kpalive->src_addr, src);
      |                 ^~~~~~~~~~~~~~~~~~
tools/sniffer.c:63:17: error: taking address of packed member of ‘struct nrf24_ll_keepalive’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
   63 |   nrf24_mac2str(&kpalive->dst_addr, dst);
      |                 ^~~~~~~~~~~~~~~~~~
tools/sniffer.c: In function ‘decode_mgmt’:
tools/sniffer.c:115:17: error: taking address of packed member of ‘struct nrf24_ll_presence’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  115 |   nrf24_mac2str(&ll->mac, src);
      |                 ^~~~~~~~
tools/sniffer.c:131:17: error: taking address of packed member of ‘struct nrf24_ll_mgmt_connect’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  131 |   nrf24_mac2str(&llcn->src_addr, src);
      |                 ^~~~~~~~~~~~~~~
tools/sniffer.c:132:17: error: taking address of packed member of ‘struct nrf24_ll_mgmt_connect’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  132 |   nrf24_mac2str(&llcn->dst_addr, dst);
      |                 ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:864: tools/sniffer-sniffer.o] Error 1
make: *** [Makefile:939: install-recursive] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant