public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "unixoid2003 at mail dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53085] writes to volatile struct members is missing Date: Tue, 24 Apr 2012 12:28:00 -0000 [thread overview] Message-ID: <bug-53085-4-gG4JSRsjE4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-53085-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53085 --- Comment #4 from brag <unixoid2003 at mail dot ru> 2012-04-24 12:27:29 UTC --- Alexander Monakov, As for me it's ok to treat whole struct as non-volatile even if it has a volatile members when doing smth like this: struct ss0 a,b; a=b; a=b; Simple example with class: class aa{ void f(); private: volatile int a; }; void aa::f(){ a=0xff; a=0xff; } arm-none-eabi-gcc -O2 -mcpu=cortex-m3 -mthumb -c test.cpp gcc-4.6.1 compiled: 00000000 <_ZN2aa1fEv>: 0: 23ff movs r3, #255 ; 0xff 2: 6003 str r3, [r0, #0] 4: 6003 str r3, [r0, #0] 6: 4770 bx lr The code is right. gcc-4.7.0 compiled: 00000000 <_ZN2aa1fEv>: 0: 23ff movs r3, #255 ; 0xff 2: 6003 str r3, [r0, #0] 4: 4770 bx lr 6: bf00 nop The code is wrong. It's not ok to write once 'volatile int a' member.
next prev parent reply other threads:[~2012-04-24 12:28 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-23 12:54 [Bug c/53085] New: write to volatile struct member is missing on Cortex-M3 unixoid2003 at mail dot ru 2012-04-23 12:58 ` [Bug c/53085] " unixoid2003 at mail dot ru 2012-04-23 13:19 ` unixoid2003 at mail dot ru 2012-04-23 13:27 ` [Bug c/53085] writes to volatile struct members is missing unixoid2003 at mail dot ru 2012-04-23 15:19 ` amonakov at gcc dot gnu.org 2012-04-24 12:28 ` unixoid2003 at mail dot ru [this message] 2012-04-24 13:07 ` [Bug tree-optimization/53085] " rguenth at gcc dot gnu.org 2012-04-24 13:14 ` rguenth at gcc dot gnu.org 2012-04-24 14:42 ` rguenth at gcc dot gnu.org 2012-04-24 14:43 ` rguenth at gcc dot gnu.org 2012-04-24 14:45 ` [Bug tree-optimization/53085] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
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-53085-4-gG4JSRsjE4@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).