-
Notifications
You must be signed in to change notification settings - Fork 49
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
Test fails to start with build option -ffast-math #85
Comments
As a quick test, I tried -ffast-math on Arduino 1.8.19 with Teensduino 1.56. I edited boards.txt, changing this line:
to this:
Then I restarted the Arduino IDE, because it doesn't re-read boards.txt automatically when it changes. Quick upload and opening the Arduino Serial Monitor seems like it's working fine. This is the code I tested: I can't say why it's not working for you. But hopefully this test with these screenshots is detailed and specific enough for you or anyone to reproduce and see for yourself -ffast-math working. |
Quick note - you'll see the screenshot shows I used CPU speed 528 MHz. I also tested at 600 MHz. Then I changed the CPU speed and tested again, just to force the Arduino IDE to recompile all files. All other settings were at their default values. |
Hey Paul! I think you might have misunderstood the problem I was describing, sorry it I was a bit unclear. As I write above I was also able to compile and upload code that uses the |
Hey there!
I am observing some weird behaviour that looks like a bug to me.
I have a
main.cpp
and atest.cpp
file, which both compile and execute fine on my Teensy 4.1. They both produce the expected output. As soon as I add the linebuild_flags = -ffast-math
to myplatformio.ini
my test breaks, while my main file still executes as expected (I can even measure the expected performance increase). Now the way the test breaks is what strikes me as odd. It compiles and uploads just fine. But then the Teensy seems to be just dead. It does not connect to the serial monitor or produce any other sort of output. I can still press the button and set it into bootloader mode and flash a new firmware, but other than that there is no response.I know
-ffast-math
is considered an unsafe option, but what makes me wonder is that the behaviour between compile+upload and compile+upload+test is so different. It feel a lot like a weird bug.Does anybody have an idea what could be causing this?
I did some more testing and here are my findings.
For my setup I am running a minimal example like this:
test/test.cpp
platformio.ini
As discribed the above example works fine. If I add the line
build_flags = -ffast-math
to the bottom of theplatformio.ini
the described breakage occures when running the test usingpio test -v
.Since according to the GCC Optimize Options
-ffast-math
is a combination of flags I tested the individual flags and this is the result:Thanks a lot to maxgerhardt who helped me on the platformio community forum. For more info see this thread: https://community.platformio.org/t/test-fails-to-start-with-build-option-ffast-math/25342
The text was updated successfully, but these errors were encountered: