[Top][All Lists]

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

[avr-gcc-list] [avr] GCCAVR Bug

From: Ron Kreymborg
Subject: [avr-gcc-list] [avr] GCCAVR Bug
Date: Mon Jan 8 22:45:04 2001

Hi All

This little C snippet embodies a bug in gccavr that cost me considerable
trackdown time in a larger program. The key is the if statement combined
with the following statement containing an array reference. If you run this
in AVRStudio the array statement gets executed every time. Doesn't matter if
the array is local or global. Change the following statement to a simple
variable assign and all is well. Change the "if" to (a > b) and all is well.

#include <stdlib.h>

#define  LIMIT      25.0
#define  MAXENTRY   5

int main(void);

int sum[MAXENTRY];

int main(void)
   int i;
   float a, b;

   a = 10.0;
   b = LIMIT;
   for (i=0; i<MAXENTRY; i++)
      if (a >= b)
         sum[i] = sum[i] + 1;
      b += LIMIT;

   return 0;

I was going to post this off to Volker but he seems to have vanished. I then
thought I would go look for the bug in the gccavr source, but the actual
compiler code that generates the avr statements does not seem to be part of
his package.

Does anybody know who we can refer gccavr bugs to? Does anybody know whether
the AVR port to gcc is available so we can try to fix this sort of bug

Ron Kreymborg

AVR, it's just better.

reply via email to

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