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

[BUG] Compiler warnings in foc_utils.cpp #296

Open
jadoro opened this issue Jul 24, 2023 · 0 comments
Open

[BUG] Compiler warnings in foc_utils.cpp #296

jadoro opened this issue Jul 24, 2023 · 0 comments

Comments

@jadoro
Copy link

jadoro commented Jul 24, 2023

When building SimpleFOC (with -Wall), I get the following compiler warnings – which unfortunately prevent a build with -Werror:

.pio/libdeps/nanoatmega328/Simple FOC/src/common/foc_utils.cpp: In function 'float _sqrtApprox(float)':
.pio/libdeps/nanoatmega328/Simple FOC/src/common/foc_utils.cpp:68:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   i = * ( long * ) &y;
                     ^
.pio/libdeps/nanoatmega328/Simple FOC/src/common/foc_utils.cpp:70:22: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   y = * ( float * ) &i;
                      ^

I'm using PlatformIO for building, with tool versions

framework-arduino-avr @ 5.1.0 
toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Simple FOC @ 2.3.0

The responsible code section already links to Wikipedia, where alternative, more modern versions of that snippet can be found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant