public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kikairoya at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/50521] -fstrict-volatile-bitfields is not strict Date: Tue, 27 Sep 2011 08:22:00 -0000 [thread overview] Message-ID: <bug-50521-4-aYtQbGnFsd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-50521-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50521 --- Comment #3 from Tomohiro Kashiwada <kikairoya at gmail dot com> 2011-09-27 04:15:19 UTC --- Other test case (gcc generates wrong code): volatile union { // add volatiles tenaciously, but... volatile unsigned int all; volatile struct { volatile unsigned int a: 8; volatile unsigned int : 7; volatile unsigned int b: 1; volatile unsigned int : 8; volatile unsigned int c: 8; } bits; } bitfield; int main() { bitfield.bits.a = 1; bitfield.bits.b = 1; bitfield.bits.c = 1; return 0; } $ gcc -S -O -o - btf.c -fstrict-volatile-bitfields .file "btf.c" .text .globl main .type main, @function main: .LFB0: .cfi_startproc movl $1, bitfield(%rip) ; **** breaks other area! **** movl bitfield(%rip), %eax orb $128, %ah movl %eax, bitfield(%rip) movl $1, bitfield+3(%rip) ; **** unaligned, and breaks other area! **** movl $0, %eax ret .cfi_endproc .LFE0: .size main, .-main .comm bitfield,4,4 .ident "GCC: (Debian 4.6.1-3) 4.6.1" .section .note.GNU-stack,"",@progbits $ rx-elf-gcc -S -O -o - btf.c -fstrict-volatile-bitfields .file "btf.c" .section P,"ax" .global _main .type _main, @function _main: mov.L #_bitfield, r14 mov.L #1, [r14] ; **** breaks other area! **** mov.L [r14], r4 bset #15, r4 mov.L r4, [r14] mov.L [r14], r4 and #0xffffff, r4 or #0x1000000, r4 mov.L r4, [r14] ; ok, aligned (my misunderstanding). mov.L #0, r1 rts .size _main, .-_main .comm _bitfield,4,4 .ident "GCC: (GNU) 4.6.1"
next prev parent reply other threads:[~2011-09-27 4:15 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-09-26 7:18 [Bug c/50521] New: " kikairoya at gmail dot com 2011-09-26 11:43 ` [Bug c/50521] " rguenth at gcc dot gnu.org 2011-09-26 12:08 ` kikairoya at gmail dot com 2011-09-27 8:22 ` kikairoya at gmail dot com [this message] 2011-10-20 1:54 ` kikairoya at gmail dot com 2011-10-27 23:23 ` henrik at henriknordstrom dot net 2011-10-28 1:33 ` kikairoya at gmail dot com 2011-10-28 2:00 ` henrik at henriknordstrom dot net 2011-10-28 3:59 ` kikairoya at gmail dot com 2011-10-28 7:34 ` henrik at henriknordstrom dot net 2011-10-28 8:13 ` kikairoya at gmail dot com 2011-10-28 8:15 ` kikairoya at gmail dot com 2011-10-28 17:46 ` henrik at henriknordstrom dot net 2011-10-29 6:50 ` kikairoya at gmail dot com 2011-10-29 10:46 ` henrik at henriknordstrom dot net 2011-10-29 14:37 ` kikairoya at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-50521-4-aYtQbGnFsd@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).