===========command line and terminal output=============================
avr-gcc -v -save-temps -Os -mmcu=atmega328p -mtiny-stack -c bug.c
Using built-in specs.
Target: avr
Configured with: ../configure --prefix=/usr/local/avr --target=avr
--disable-nls --enable-languages=c --disable-libssp --with-dwarf2 --with-gmp
--with-mpfr
Thread model: single
gcc version 4.4.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Os' '-mmcu=atmega328p' '-mtiny-stack'
'-c'
/usr/local/avr/libexec/gcc/avr/4.4.1/cc1 -E -quiet -v -imultilib avr5 bug.c
-mmcu=atmega328p -mtiny-stack -Os -fpch-preprocess -o bug.i
ignoring nonexistent directory
"/usr/local/avr/lib/gcc/avr/4.4.1/../../../../avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/avr/lib/gcc/avr/4.4.1/include
/usr/local/avr/lib/gcc/avr/4.4.1/include-fixed
/usr/local/avr/lib/gcc/avr/4.4.1/../../../../avr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Os' '-mmcu=atmega328p' '-mtiny-stack'
'-c'
/usr/local/avr/libexec/gcc/avr/4.4.1/cc1 -fpreprocessed bug.i -quiet -dumpbase
bug.c -mmcu=atmega328p -mtiny-stack -auxbase bug -Os -version -o bug.s
GNU C (GCC) version 4.4.1 (avr)
compiled by GNU C version 4.3.2 [gcc-4_3-branch revision 141291], GMP
version 4.2.3, MPFR version 2.4.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 58a947ee803f6389bca1fc492674e96f
bug.c: In function 'rsfc':
bug.c:27: internal compiler error: in emit_move_insn, at expr.c:3405
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
========standalone source file=======================
// bug.c
static void
swf(void *src) {
unsigned char i = 0;
while (i < 4) {
(*(volatile unsigned char *)((0x2E) + 0x20)) = ((unsigned char *)src)[i++];
do {;} while (!((*(volatile unsigned char *)((0x2D) + 0x20)) & ((unsigned
char)(0x01 << (7)))));
}
}
static void
sipa (unsigned char instruction) {
unsigned char write_buf[4];
swf (&write_buf[0]);
}
void
rsfc (void) {
sipa (0x03);
}
==========bug.i==============================
# 1 "bug.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "bug.c"
static void
swf(void *src) {
unsigned char i = 0;
while (i < 4) {
(*(volatile unsigned char *)((0x2E) + 0x20)) = ((unsigned char *)src)[i++];
do {;} while (!((*(volatile unsigned char *)((0x2D) + 0x20)) & ((unsigned
char)(0x01 << (7)))));
}
}
static void
sipa (unsigned char instruction) {
unsigned char write_buf[4];
swf (&write_buf[0]);
}
void
rsfc (void) {
sipa (0x03);
}
=================bug.s==========================='
.file "bug.c"
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
===========================================
Removing the -mtiny-stack option allows the compilation to succeed.
Kirk Hays
--
Summary: -mtiny-stack causes internal compiler error on gcc for
avr
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: khays at hayshaus dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44506