Closed
Description
The following program will crash the 5.4.0 avr-gcc compiler used in AVR core 1.6.22 (IDE 1.8.6). The problem does not happen in AVR core 1.6.21 (IDE 1.8.5):
void setup() {}
void loop() {
static const __FlashStringHelper* F_STRING = F("fstring");
Serial.println(F_STRING);
}
The error message is:
lto1: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: fatal error: /home/brian/dev/arduino-1.8.6/hardware/tools/avr/bin/avr-gcc returned 1 exit status
compilation terminated.
/home/brian/dev/arduino-1.8.6/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano.
Interestingly, the following alternatives do not cause problems:
void setup() {}
static const char P_STRING[] PROGMEM = "pstring";
void loop() {
Serial.println((const __FlashStringHelper*) P_STRING); // ok
Serial.println(F("inline fstring")); // ok
}
My environment is Ubuntu Linux 17.10, but another person on the Arduino Forum thread reports the same error on Windows 10.