GNU Development Chain for 68HC11/68HC12 - Bugs: bug #17442, wrong code optimization
You are not allowed to post comments on this tracker with your current authentication level.
bug #17442: wrong code optimization
Submitter: | None | ||
Submitted: | Wed 16 Aug 2006 11:14:54 AM UTC | ||
Category: | gcc | Severity: | 3 - Normal |
Item Group: | sw-bug | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
CC list is empty
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
No changes have been made to this item
Powered by Savane 3.13-f8d8.
Corresponding source code
Switching from Release 2.1.0 to Release 3.1 I found following problem. I had code like this:
typedef unsigned char uint8;
typedef struct StructDate {uint8 Day; uint8 Month; uint8 Year; uint8 Weekday;} Date;
volatile Date today;
void doSth(volatile Date* ptr)
{
uint8_to_lcd(ptr->Day);
}
void main()
{
today.Day = 1;
today.Month = 1;
today.Year = 2006;
today.Weekday = 1;
doSth(&today);
}
Looking inside the memory I saw, that today.Day is set correctly. But ptr->Day returns a wrong value (always 0x1b). ptr-Month etc. do return the right value, so the problem is only in the first field of the structure.
This error only occurs if optimization is turned on, if no -O is given to the compiler the code works. I only tried -m68hcs12 and -m68hc12 since I do not have a HC11.