I use openSUSE 13.2, 32 bit. As AVR environment I use packages from CrossToolchain:avr.
After last update of the avr-gcc I found an error in the c compiler.
Compiler info:
> avr-gcc -v Using built-in specs. Reading specs from /opt/cross/lib/gcc/avr/5.4.0/device-specs/specs-avr2 COLLECT_GCC=/opt/cross/bin/avr-gcc COLLECT_LTO_WRAPPER=/opt/cross/libexec/gcc/avr/5.4.0/lto-wrapper Target: avr Configured with: ../gcc-5.4.0/configure -v --target=avr --disable-nls --mandir=/opt/cross/share/man --infodir=/opt/cross/share/info --program-prefix=avr- --prefix=/opt/cross --with-gnu-ld --with-gnu-as --enable-languages=c,c++ --disable-libssp --with-dwarf2 Thread model: single gcc version 5.4.0 (GCC)
Test program (minimal example):
#include <avr/io.h> void test(void) { SFIOR |= _BV(PSR0); }
Compilation:
> avr-gcc -c -mmcu=atmega128 -Os -save-temps test.c test.s: Assembler messages: test.s:16: Error: operand out of range: 32
Saved assembler file test.s:
.file "test.c" __SP_H__ = 0x3e __SP_L__ = 0x3d __SREG__ = 0x3f __RAMPZ__ = 0x3b __tmp_reg__ = 0 __zero_reg__ = 1 .text .global test .type test, @function test: /* prologue: function */ /* frame size = 0 */ /* stack size = 0 */ .L__stack_usage = 0 sbi 0x20,1 ret .size test, .-test .ident "GCC: (GNU) 5.4.0"
This error occurs in any optimization level except O0, where the sbi instruction isn't used.
Could someone confirm this error? I don't know if it is in this version of the compiler or only in this package.