avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] possible 4.1.2 bug


From: John Regehr
Subject: [avr-gcc-list] possible 4.1.2 bug
Date: Wed, 28 Mar 2007 22:14:52 -0600
User-agent: Thunderbird 1.5.0.10 (X11/20070302)

Hi all-

The code below, compiled with avr-gcc 4.1.2 like this

  avr-gcc -c -Os -mmcu=atmega128 prob.c

produces faulty assembly code that attempts ldi into r14. I'm not at all sure that the asm is correct (didn't write it) but it seems that gcc shouldn't be picking an unusable register in any case. The only other version I tried is 3.4.3 which has the same problem.

Figured I'd check here to see if I'm missing something silly before filing a bug.

John Regehr


void foo (char, char, char, char, char);

short bar (void)
{
  char a = 0;
  volatile char b = 0;
  char c = 0;
  char d = 0;
  char e = 0;
  int in;
  int out;

  foo (e, d, c, b, a);

  __asm__ ("swap %B1 \n\t"
           "swap %C1 \n\t"
           "swap %D1 \n\t"
           "ldi %A1, 0xf0 \n\t"
           "eor %D1, %C1 \n\t"
           "and %D1, %A1 \n\t"
           "eor %D1, %C1 \n\t"
           "eor %C1, %B1 \n\t"
           "and %C1, %A1 \n\t"
           "eor %C1, %B1 \n\t"
           "movw %A0, %C1 \n\t"
           : "=&r" (out) : "r" (in));

  return out;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]