This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/43876] [avr] Improper updating of struct members when written out of order from struct definition



------- Comment #2 from justin at mattair dot net  2010-04-29 02:38 -------
Created an attachment (id=20511)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20511&action=view)
patch for patch-xmega

It looks like possibly a copy-paste error was made in the patch-xmega file. The
following starting on line 573 of patch-xmega (from the
build-avr-gcc-4.3.4-binutils-2.20-libc-1.6.8-insight6.8-dude-5.10-insight-patch
script available on AVRFreaks.net):

+        return *l = 4, (AS2 (sbiw,%r0,1)    CR_TAB 
+                        AS2 (st,%p0+,%A1)   CR_TAB
+                        AS2 (st,%p0,%B1)    CR_TAB
+                        AS2 (sbiw,%r0,2));

I think should be:

+        return *l = 4, (AS2 (sbiw,%r0,2)    CR_TAB 
+                        AS2 (st,%p0+,%A1)   CR_TAB
+                        AS2 (st,%p0,%B1)    CR_TAB
+                        AS2 (sbiw,%r0,1));

This may have been caused by copying code from one of the post-increment
sections utilizing adiw, then converting it to pre-decrement utilizing sbiw,
then forgetting to swap the 2 and 1.

I assume that the second sbiw instruction is needed to put the pointer back at
the location it was at after the first sbiw.
Someone more knowledgeable about GCC's innards should check this.
Attached is a patch for the patch-xmega, um, patch.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]