I have a solution with 5 projects that I compile in Atmel Studio. When I do, there is sometimes a random segfault. If I try to recompile a few times, then everything works. The segfault doesn't seem to be in some specific place or project. Sometimes only one project segfaults, sometimes a few.
I am currently using Atmel Studio 7.0.1417 with avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.0_1734) 5.4.0
I have tried with a newer version of Atmel Studio: 7.0.1931 and avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.1_1750) 5.4.0, but there are just more segmentation faults!
According to the release notes from Atmel Studio, there should be bug fixes that:
from here: http://studio.download.atmel.com/7.0.1931/as-installer-7.0.1931-readme.pdf
My solution has links between projects and some code that is shared with another solution. I think there has to be something unusual about the way I have set up the solution, otherwise people would get segmentation faults often and this would be fixed.
Here is a discussion from March this year, were someone seems to have had the same kind of problem as me: https://www.avrfreaks.net/forum/has-segmentation-faults-been-fixed
There is no solution to it though.
Does anyone know why this is happening? Is there some work around, other than running on an old compiler that I'm already doing?
This seems to have been a bug in the avr-gcc toolchain. The newest version of Atmel Studio is still 7.0.1931, but they have released a newer toolchain, AVR_8_bit_GNU_Toolchain_3.6.2_1759. You can find it here: https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers
and then simply replace the toolchain that you have installed. For a standard installation, this would be: C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8