Created attachment 38934 [details] Pre-processed C file with the minimum amount of code to generate this bug. The push_reload error is very sensitive to any changes to the source code. The minimum subset to reproduce the error is attached. The error with the attached pre-processed C file is as follows: reload_bug.c: In function 'push_reload_error': reload_bug.c:96:1: internal compiler error: in push_reload, at reload.c:1360 and is generated with the following minimum call where the -Os optimization is required and is the only optimization setting that fails: avr-gcc -Os -S reload_bug_pre.c The details of the avr-gcc build are as follows: Using built-in specs. COLLECT_GCC=avr-gcc COLLECT_LTO_WRAPPER=/usr/local/Cellar/avr-gcc/4.9.3/libexec/gcc/avr/4.9.3/lto-wrapper Target: avr Configured with: ../configure --target=avr --prefix=/usr/local/Cellar/avr-gcc/4.9.3 --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-ld=/usr/local/opt/avr-binutils/bin/avr-ld --with-as=/usr/local/opt/avr-binutils/bin/avr-as --disable-nls --disable-shared --disable-threads --disable-libssp --disable-libstdcxx-pch --disable-libgomp --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-system-zlib Thread model: single gcc version 4.9.3 (GCC) Note that the following construct seen (and required) in the file: (__extension__({static const char __c[] = (""); &__c[0];})) comes from the macro PSTR defined in the AVR header pgmspace.h
Note that there are minor variations of this code that do not generate a compiler error but generate bad compiler code, but I no longer have that case available. Hopefully the fix to this problem will also fix the bad compiler output. This may indicate that the bug generates an internal compiler condition that is not always detected and reported as an error.
Adding "-fno-move-loop-invariants" to the compilation request makes the problem go away, but I've seen some situations where even this is not sufficient. A discussion about this bug is in the following thread: http://www.avrfreaks.net/forum/atmel-studio-62-issue-pushreload-reloadc1360q where post #12 indicates that the problem exists in gcc versions from 4.8.0 to 6.1.1 but that 4.7.1 works fine.
Created attachment 38936 [details] Slightly simpler pre-processed C file that demonstrates bug Slightly simpler in that only one parameter is needed in the "func" function. I also made some log_printf calls have more consistent types, but I can't convert the variadic function "printf10fixed" to two fixed parameter functions without the bug going away.
Maintainers did not approve backporting, so fixed on trunk (7.0) only.
Maintainers did not approve backporting, so fixed on trunk (7.0) only. *** This bug has been marked as a duplicate of bug 71873 ***