platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
138 stars 105 forks source link

std::floor() on a float crashes Arduino Nano #144

Open systemofapwne opened 5 years ago

systemofapwne commented 5 years ago

Hello, I have been redirected here to give an error report.

Calling std::floor() on a float, the arduino gets stuck. Compiling with Arduino IDE instead of PlatformIO does not cause this issue. Using double as datatype does also not cause the issue. Only when using float and PlatformIO.

I tested this on my Arduino Nano (new Bootloader) via PlatformIO and the following platformio.ini [env:uno] platform = atmelavr board = uno framework = arduino monitor_port = COM3 monitor_speed = 9600

Here is an example code, which will make your Arduino unresponsive main.cpp

``

include

include

void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.println("Did you crash?"); float a = 1.9; std::floor(a); Serial.println("No!"); }

void loop() { // put your main code here, to run repeatedly: } ``

It will print "Did you crash?" on screen while never reaching the Serial.println("No!").