public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/50364] Volatile miscompilation Date: Thu, 13 Oct 2011 08:43:00 -0000 [thread overview] Message-ID: <bug-50364-4-EboHheRjEC@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-50364-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50364 Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-13 08:43:10 UTC --- That works as designed. See the recent discussion about this very topic on the gcc mailinglist and 2010-08-19 Nathan Sidwell <nathan@codesourcery.com> Richard Guenther <richard.guenther@gmail.com> * gimplify.c (gimplify_modify_expr): When assigning to volatiles, copy the src value and return a copy. * doc/extend.texi (Volatiles): Move from C++ to C and expand. (C++ Volatiles): Adjust to describe C++ semantics only. esp. "Assignments are also expressions and have an rvalue. However when assigning to a scalar volatile, the volatile object is not reread, regardless of whether the assignment expression's rvalue is used or not. If the assignment's rvalue is used, the value is that assigned to the volatile object. For instance, there is no read of @var{vobj} in all the following cases: @smallexample int obj; volatile int vobj; vobj = @var{something}; obj = vobj = @var{something}; obj ? vobj = @var{onething} : vobj = @var{anotherthing}; obj = (@var{something}, vobj = @var{anotherthing}); @end smallexample If you need to read the volatile object after an assignment has occurred, you must use a separate expression with an intervening sequence point."
prev parent reply other threads:[~2011-10-13 8:43 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-09-12 9:16 [Bug c++/50364] New: " abramobagnara at tin dot it 2011-10-12 15:55 ` [Bug c++/50364] " paolo.carlini at oracle dot com 2011-10-13 8:43 ` rguenth at gcc dot gnu.org [this message]
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-50364-4-EboHheRjEC@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).