[Bug c/27556] New: Wrong code generation when cross compile for attiny2313

p dot mateja at sh dot cvut dot cz gcc-bugzilla@gcc.gnu.org
Thu May 11 14:22:00 GMT 2006


I found a bug in gcc compiler. I'm trying to cross compile simple program using
debian package avr-gcc (gcc version 4.1.0) using command

avr-gcc -mmcu=attiny2313 -Wall -Os -c test.c

I have problem with very simple code when using array bigger than 128 bytes.

char text[] = "AB... ....YZ"; // 128 characters
char *pointer = text;

while (*pointer) {
        UDR = *pointer;
        while ( !(UCSRA & (1<<UDRE)));
        pointer++;
}

This code is not working. When I remove 128th character it's OK.
The problem is in the pointer. I tried to make asm from the working and
non-working sources using

avr-gcc -mmcu=attiny2313 -Wall -Os -S test.c

and the important part of diff is just

<       ldi r24,lo8(-127)
---
>       ldi r24,lo8(-128)

There is no other code working with the higher byte.
r* registers are just 8bit so it can't work at all.


-- 
           Summary: Wrong code generation when cross compile for attiny2313
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: p dot mateja at sh dot cvut dot cz
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: attiny2313


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27556



More information about the Gcc-bugs mailing list