This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/43876] [avr] Improper updating of struct members when written out of order from struct definition
- From: "justin at mattair dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Apr 2010 02:38:03 -0000
- Subject: [Bug target/43876] [avr] Improper updating of struct members when written out of order from struct definition
- References: <bug-43876-19082@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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