This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/19329] New: [3.4 Regression] Miscompilation with bitfields
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jan 2005 17:46:42 -0000
- Subject: [Bug target/19329] New: [3.4 Regression] Miscompilation with bitfields
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The testcase I'm going to attach generates a miscompilation on the 3.4 branch.
The bug cannot be reproduced on 4.0 but might actually be latent there.
The code it's copying 4 1-bit fields from one structure to a different one. The
internal bit offsets of the fields are different by just one bit between the
two structures.
This is an except of the generate code:
lsl r18 # source bitfield disposition is 1bit
# shifited compared to the original, so GCC
# adjust it
andi r24,lo8(-25) # clear bits it's going to write
mov r25,r18
clr r25 # *BUG* it will always write zero
# instead of copying the value
andi r25,lo8(16)
andi r18,lo8(8)
or r24,r18 # write correct bit
or r24,r25 # write zero (sigh!)
--
Summary: [3.4 Regression] Miscompilation with bitfields
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: giovannibajo at libero dot it
CC: aleph at develer dot com,bernie at develer dot com,gcc-
bugs at gcc dot gnu dot org,sayle at gcc dot gnu dot org
GCC target triplet: avr-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19329