Arduino IDE Compilation Error

Hi,
in IDE version 1.8.8 and 1.8.9 i am getting an unpredictable compilation error while trying to upload sketch to the Arduino Uno board.
I found out that i check the last lines as remark and compile - the error is gone’ than i Unchecked the lines and they are back in the code - compile successfully.
The odd error are not consistent.

any suggestions?

the Error log looks like that:

In function ‘global constructors keyed to 65535_0_Pulse_Counter_MQTT_Proto_v001.ino.cpp.o’:

lto1.exe: internal compiler error: Segmentation fault

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: D:\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

d:/arduino/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 compiling for board Arduino/Genuino Uno.

Use board manager to downgrade official AVR board package to 1.6.21 - there is a bug in the compiler that 1.6.22 and 1.6.23 use, and for reasons that baffle me, despite working versions of the compiler existing, one even being made into a test package that demonstrates that it works with Arduino, they have neither released a new official version that uses that new compiler, nor rolled back the changes and done a new release to get rid of the bug.

Thank you!

is it safe to roll back?
from you experience would the board work as it should?

Yes, it's safe to roll back to 1.6.21. It's nice to have the newer compiler version (if it worked properly), but the old one worked just fine for many of thousands of people for years. It's very unlikely you'll ever notice the difference between the compiler versions.

Thanks a lot !!!