bugGNU 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

Submitted by:  None
Submitted on:  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

Wed 16 Aug 2006 11:14:54 AM UTC, original submission:  

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)

void main()
  today.Day = 1;
  today.Month = 1;
  today.Year = 2006;
  today.Weekday = 1;

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.



No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


Do you think this task is very important?
If so, you can add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.




No changes have been made to this item

Back to the top

Powered by Savane 3.5