[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: [avr-gcc-list] Code that fails to compile with any optimizationenabl
From: |
Haase Bjoern (PT/EMM) |
Subject: |
AW: [avr-gcc-list] Code that fails to compile with any optimizationenabled |
Date: |
Mon, 23 Apr 2007 09:08:40 +0200 |
Hi,
You have found a real bug that most probably resides in the dreaded "reload"
pass of the compiler. I know a solution for such issues (forcing more variables
on the stack instead of holding them in registers) but this would result in
much worse (i.e. larger) code for most other situations.
Please post a bug report. Since I do not expect a rapid solution of the issue,
I'd like to suggest you to try to find a work-around. E.g. by trying to split
your problem function in several smaller functions (probably with __attribute__
((noinline))).
Yours,
Björn
-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von Dave Hylands
Gesendet: Freitag, 20. April 2007 22:45
An: AVR-GCC-list
Betreff: [avr-gcc-list] Code that fails to compile with any optimizationenabled
Hi,
The following code snippet (as small as I could get it and still
reproduce the problem) fails to compile with the following command
line:
avr-gcc -c -mmcu=atmega168 ee-fail.c -Os
Dropping the -Os or using -O0 makes it work. Using -O1 -O2 -O3 or -Os
all cause the following errors:
606 >avr-gcc -c -mmcu=atmega168 ee-fail.c -O3
ee-fail.c: In function 'build_pwm_table':
c:/winavr/bin/../avr/include/avr/eeprom.h:208: error: can't find a
register in class 'BASE_POINTER_REGS' while reloading 'asm'
c:/winavr/bin/../avr/include/avr/eeprom.h:208: error: can't find a
register in class 'BASE_POINTER_REGS' while reloading 'asm'
Removing the second call to fill_pwm_table also allows things to work
with all optimization levels.
I figured I'd post to the list to discuss before filing a bug report.
#include <avr/eeprom.h>
uint8_t pwm_tab_1 [126];
static uint16_t ee_chan_1_min EEMEM = 140,
ee_chan_1_cent EEMEM = 188,
ee_chan_1_max EEMEM = 240,
ee_chan_1_forw_min EEMEM = 20,
ee_chan_1_forw_max EEMEM = 90,
ee_chan_1_back_max EEMEM = 80;
void fill_pwm_table (int8_t chan_num, uint8_t pwm [], int16_t forward_max,
int16_t center, int16_t reverse_min, int16_t forward_high,
int16_t forward_low, int16_t reverse_high );
void build_pwm_table (void)
{
int16_t center_1,
forward_max_1,
reverse_min_1,
forward_high_1,
forward_low_1,
reverse_high_1;
center_1 = eeprom_read_word (&ee_chan_1_cent);
forward_max_1 = eeprom_read_word (&ee_chan_1_max);
reverse_min_1 = eeprom_read_word (&ee_chan_1_min);
forward_high_1 = eeprom_read_word (&ee_chan_1_forw_max);
forward_low_1 = eeprom_read_word (&ee_chan_1_forw_min);
reverse_high_1 = eeprom_read_word (&ee_chan_1_back_max);
fill_pwm_table (1, pwm_tab_1, forward_max_1, center_1, reverse_min_1,
forward_high_1, forward_low_1, reverse_high_1);
fill_pwm_table (1, pwm_tab_1, forward_max_1, center_1, reverse_min_1,
forward_high_1, forward_low_1, reverse_high_1);
}
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list