Internal Compiler Error...

Got a new one today, on a new project. The code is a very simple example using the IRLib2 library. It compiles fine, and fails in linking, with this error:

lto1.exe: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624

I'm currently using v1.8.9, which has been working fine for a long time on many other projects. I don't have the first clue what to do other than try a different version. Any ideas?

Here is the (trimmed) output showing the error in linking:

...
Archiving built core (caching) in: C:\Users\RayL\AppData\Local\Temp\arduino_cache_678184\core\core_arduino_avr_pro_cpu_16MHzatmega328_1282fd756beb609614cd04e2a9e48907.a
Linking everything together...
"E:\\Users\\RayL\\Documents\\AppData\\Arduino\\arduino-1.8.9\\hardware\\tools\\avr/bin/avr-gcc" -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections "-Wl,-Map,C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\RemoteTranslator.ino.map" -mmcu=atmega328p -o "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983/RemoteTranslator.ino.elf" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\RemoteTranslator.ino.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLib2\\IRLibDecodeBase.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLib2\\IRLibRecvBase.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLib2\\IRLibRecvLoop.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibFreq\\IRLibFreq.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibProtocols\\IRLibHardware.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibProtocols\\IRLibProtocols.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibProtocols\\IRLibSAMD21.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibProtocols\\IRLibSAMD51.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibProtocols\\IRLibSendBase.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibRecvPCI\\IRLibRecvPCI.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983\\sketch\\src\\IRLibRecv\\IRLibRecv.cpp.o" "C:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983/core\\core.a" "-LC:\\Users\\RayL\\AppData\\Local\\Temp\\arduino_build_503983" -lm
lto1.exe: 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.exe: fatal error: E:\Users\RayL\Documents\AppData\Arduino\arduino-1.8.9\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

e:/users/rayl/documents/appdata/arduino/arduino-1.8.9/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
[Error] Exit with code=1

Regards,
Ray L.

Whaddya know! The author of the IRLib2 library found EXACTLY the same problem:

https://forum.arduino.cc/index.php?topic=574020.0

Regards,
Ray L.

Reverted to v 1.8.4, and it now compiles ok.

It is disappointing how often Arduino releases have this kind of problem....

Regards,
Ray L.

The version of the Arduino IDE itself is irrelevant with these kinds of issues, the relevant version is the version of the Arduino AVR Core (see Tools > Board > Boards manager).

You seem to be using an old version of the toolchain, most likely GCC 5.4, the latest AVR Core (1.8.3) comes with GCC 7.3, and it compiles and links just fine for me (on Ubuntu 20.04). When switching to an older Core version (1.6.23) which uses a GCC 5.4 toolchain, I get the same error.

RayLivingston:
It is disappointing how often Arduino releases have this kind of problem....

This isn't an issue with Arduino specifically, it's a bug in upstream GCC/Binutils. TBH, it's not that surprising that there are bugs like these, I think it's more surprising that they get fixed, since AVR is not exactly a high priority for most compiler maintainers ...

The beauty of open-source software is that you can help resolve bugs you encounter. Just expressing your disappointment about software you didn't pay for usually doesn't fix the issue.

Pieter