Bug 71932 - internal compiler error: in push_reload, at reload.c:1360
Summary: internal compiler error: in push_reload, at reload.c:1360
Status: RESOLVED DUPLICATE of bug 71873
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.9.3
: P3 normal
Target Milestone: ---
Assignee: Senthil Kumar Selvaraj
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-07-19 15:41 UTC by Richard Falk
Modified: 2016-10-20 12:12 UTC (History)
0 users

See Also:
Host:
Target: Avr
Build:
Known to work: 4.7.1
Known to fail: 6.1.1
Last reconfirmed:


Attachments
Pre-processed C file with the minimum amount of code to generate this bug. (441 bytes, text/plain)
2016-07-19 15:41 UTC, Richard Falk
Details
Slightly simpler pre-processed C file that demonstrates bug (427 bytes, text/plain)
2016-07-19 17:01 UTC, Richard Falk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Falk 2016-07-19 15:41:55 UTC
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
Comment 1 Richard Falk 2016-07-19 15:48:29 UTC
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.
Comment 2 Richard Falk 2016-07-19 15:59:00 UTC
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.
Comment 3 Richard Falk 2016-07-19 17:01:54 UTC
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.
Comment 4 Senthil Kumar Selvaraj 2016-10-20 12:11:40 UTC
Maintainers did not approve backporting, so fixed on trunk (7.0) only.
Comment 5 Senthil Kumar Selvaraj 2016-10-20 12:12:09 UTC
Maintainers did not approve backporting, so fixed on trunk (7.0) only.

*** This bug has been marked as a duplicate of bug 71873 ***