Segmentation Faults

Hello everyone,
I am getting very frequent “Segmentation Faults” in a variety of projects. The solution that usually works is to clean the code or to simply move some code around, it usually compiles OK. That works most of the time, but not always.

There are always three error messages:
Severity Code Description File Line
Error fatal error: D:\Arduino\hardware\tools\avr\bin\avr-gcc returned 1 exit status lto-wrapper.exe
Error error: lto-wrapper failed d:\arduino\hardware\tools\avr\avr\bin\ld.exe -1
Error error: ld returned 1 exit status collect2.exe

and this warning:
Severity Code Description File Line
Warning internal compiler error Segmentation fault

Is there something that causes these segmentation faults? Is there a compiler upgrade that will fix this problem?

This is a compiler bug in the version of the compiler used for versions 1.6.22 and 1.6.23 of the official avr board package. For reasons unclear to me, arduino has not released a newer version that either reverts the compiler or uses a newer version without the bug.

Use board manager (tools->board->board manager) to downgrade official avr board package to 1.6.21.