[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] possible compiler/optimizer problem (?)
From: |
Gary Douglas |
Subject: |
[avr-gcc-list] possible compiler/optimizer problem (?) |
Date: |
Mon, 30 May 2005 11:31:54 -0600 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050317) |
Hi all,
Not sure if this is a bug, or if what I'm trying to do is just incorrect
C syntax. Regardless, the compiler doesn't warn about the following:
void led_blinky()
{
static uint8_t value= 1;
value != value;//This is the problem line - always true
if(value)
{
PORTD &= ~(1<<7);
}
else
{
PORTD |= (1<<7);
}
}
If I change it to this it works:
void led_blinky()
{
static uint8_t value= 1;
value = (!value); //This works...
if(value)
{
PORTD &= ~(1<<7);
}
else
{
PORTD |= (1<<7);
}
}
Are these not fundamentally the same?
FYI: Using avr-gcc 3.4.3 on FC1 Linux.
Configured with: ../../source/gcc-3.4.3/configure -v --target=avr
--disable-nls --prefix=/tools/avr --with-gnu-ld --with-gnu-as
--enable-languages=c,c++ --quiet --with-dwarf2
Thread model: single
gcc version 3.4.3
Regards,
Gary Douglas
--
Gary Douglas
Manager - Network Products
Pathway Connectivity Inc.
Inglewood Plaza, Unit 103
1439 - 17 Avenue SE
Calgary, Alberta
Canada. T2G 1J9
+1.403.243-8110 x43
www.pathwayconnect.com
- [avr-gcc-list] possible compiler/optimizer problem (?),
Gary Douglas <=