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

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

[avr-gcc-list] Bug: strlen inline expansion incorrect with -O3


From: Peter Fleury
Subject: [avr-gcc-list] Bug: strlen inline expansion incorrect with -O3
Date: Wed Jan 31 10:03:05 2001

The following code returns wrong string len when
compiled  with -O3, but correct result with -O2.

avr-gcc -c -g -O3 -mmcu=at90s8515 test.c -o test.o

Can anybody reproduce this ?

Peter Fleury

------------ test.c ----------
#include <io.h>
#include <string.h>

int main(void)
{
size_t len;
char buffer[32];

outp(0xff, DDRB);
outp(0xff, PORTB);

strcpy(buffer,"12345");
len = strlen(buffer);  // returns wrong length
outp(len,PORTB);

for(;;);
}
----------------------






reply via email to

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