there is a bug in avr-gcc (GCC) 3.4.5, that comes with the latest WinAVR distribution (20060125). The avr-gcc (GCC) 3.4.3, that comes with WinAVR 20050214 does NOT contain this bug. The bug exists with and without optimization (I tried -O0 and -Os) If you try to copy a structure with *struct_pointer = struct; the struct_pointer gets destroyed. The assembler code generated seems to add one structure length foreach copied byte to the pointer. The complete code is attached. (there I use *struct_pointer++, but it is the same problem there).
-- Summary: avr-gcc (GCC) 3.4.5 Bug: copying structure through pointer will destroy the pointer Product: gcc Version: 3.4.5 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cajus dot hahn at de dot abb dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26118