------- Comment #4 from pavel dot petrovic at gmail dot com  2007-07-28 20:24 
-------
This bug is quite cruel. I have similar application, also for atmega168 and
WinAVR (avr-gcc (GCC) 4.1.2 (WinAVR 20070525)), and the following lines do not
compile giving the same error. Even worse, if the code is with for-loop, it
compiles, but it crashes when the variable is accessed, or it overwrites
it with a value of a different variable (that is not very neighboring one).

  //load calibrated values from eeprom  
  left_ir_min = eeprom_read_word((uint16_t*)0);
  left_ir_center = eeprom_read_word((uint16_t*)2);
  left_ir_max = eeprom_read_word((uint16_t*)4);
  right_ir_min = eeprom_read_word((uint16_t*)6);
  right_ir_center = eeprom_read_word((uint16_t*)8);
  right_ir_max = eeprom_read_word((uint16_t*)10);

  left_rot[0] = eeprom_read_word((uint16_t*)12);
  right_rot[0] = eeprom_read_word((uint16_t*)14);
  left_rot[1] = eeprom_read_word((uint16_t*)16);
  right_rot[1] = eeprom_read_word((uint16_t*)18);
  left_rot[2] = eeprom_read_word((uint16_t*)20); 
  /* any of the following lines, if present, cause compiler to fail */
  right_rot[2] = eeprom_read_word((uint16_t*)22); 
  left_rot[3] = eeprom_read_word((uint16_t*)24); 
  right_rot[3] = eeprom_read_word((uint16_t*)26); 


-- 

pavel dot petrovic at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pavel dot petrovic at gmail
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31644

Reply via email to