Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Pointer Arithmetic & UB |
| Date | 2012-12-21 23:52 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kb2sod$13n$1@speranza.aioe.org> (permalink) |
| References | (8 earlier) <kaodld$4gb$1@dont-email.me> <kavcm1$pv9$1@dont-email.me> <kb160d$kpg$1@dont-email.me> <kfn4njf5cna.fsf@x-alumni2.alumni.caltech.edu> <kb2phn$5fl$1@dont-email.me> |
Shao Miller <sha0.miller@gmail.com> wrote: > On 12/21/2012 16:16, Tim Rentsch wrote: (snip) >> IMO this conclusion is wrong. The consequences of volatile access (ie, >> the extra-linguistic side effects) are outside the domain of 6.5p2, >> because it is concerned only with program expressions, not other >> unknown memory changes. This view is explained in more detail in my >> response to Ben Bacarisse in this thread. > I read the other response. And what about if 'x' and "foo counter" are > the same scalar? Regardless of that or any other example, N1570's > informative Annex I, point 2 includes: > "An ??????unordered?????? binary operator (not comma, &&, or ||) contains a > side effect to an lvalue in one operand, and a side effect to, or an > access to the value of, the identical lvalue in the other operand (6.5)." This seems to be for expressions like (x++)+(x). Also, it seems to indicate that access isn't a side affect. > Informative Annex J "Portability issues", J.2 "Undefined behavior", > point 1 includes: > "A side effect on a scalar object is unsequenced relative to either a > different side effect on the same scalar object or a value computation > using the value of the same scalar object (6.5)." > Why wouldn't the Standard discuss "stored value" or "modification" > instead of using the looser "side effect"? 5.1.2.3p2: > "Accessing a volatile object, modifying an object, modifying a file, > or calling a function that does any of those operations are all side > effects,12) which are changes in the state of the execution environment. > Evaluation of an expression in general includes both value computations > and initiation of side effects. Value computation for an lvalue > expression includes determining the identity of the designated object." Is there any indication in the standard on what "side affect" means for volatile data? I/O registers have been mentioned in the discussion, but is that in the standard? There have been systems with self-incrementing or self-decrementing memory locations. If one was used for a volatile variable, then there is an obvious side effect. > There is no need for any extra-linguistic side effect, since "accessing > a volatile object" is a side effect by its own right. I think examples > can still be helpful, though. > 6.7.3p7: > "An object that has volatile-qualified type may be modified in ways > unknown to the implementation or have other unknown side effects. > Therefore any expression referring to such an object shall be evaluated > strictly according to the rules of the abstract machine, as described in > 5.1.2.3. Furthermore, at every sequence point the value last stored in > the object shall agree with that prescribed by the abstract machine, > except as modified by the unknown factors mentioned previously.134) What > constitutes an access to an object that has volatile-qualified type is > implementation-defined." Sometimes "access" means fetch but not store. I am not so sure in this case either way. > If the last sentence here means that an implementation has license to > redefine that one or both of a read or a store is _not_ an access to a > volatile-qualified type, then it cannot abide by the second sentence, > which involves the semantics of reading and modifying. If one accepts > that the final sentence is not allowing for a redefinition of "access," > then it must be allowing for a definition of what [else] _constitutes_ > an access, such as: > - A clock tick increments the stored value of a tick-counter > - A read of a usage-counter increments the stored value of the usage-counter > - A read of the value of an object used for obtaining random values > causes the object's stored value to change to a new random value Seems to me that these all have to be implementation dependent (or implementation defined), in which case the effects and meaning of "volatile" should also be so defined. > "Undefined" by the Standard can obviously be defined by the > implementation, but need not be, which is why I'd suggest that it's > undefined. (The implementation doesn't have to know, document, or be > consistent about it.) -- glen
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pointer Arithmetic & UB Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2012-12-10 17:14 +0000
Re: Pointer Arithmetic & UB "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-12-10 09:35 -0800
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-10 12:55 -0500
Re: Pointer Arithmetic & UB Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-10 13:25 -0500
Re: Pointer Arithmetic & UB falk@rahul.net (Edward A. Falk) - 2012-12-11 00:46 +0000
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-10 21:28 -0500
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-12 14:36 -0500
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-12 20:35 +0000
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-12 15:57 -0500
Re: Pointer Arithmetic & UB Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-12 16:02 -0500
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-12 16:13 -0500
Re: Pointer Arithmetic & UB Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-12 21:18 -0500
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-12 22:42 -0500
Re: Pointer Arithmetic & UB Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-17 12:04 +0200
Re: Pointer Arithmetic & UB Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-17 08:47 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-17 14:58 +0000
Re: Pointer Arithmetic & UB Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-17 10:59 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-17 17:26 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2012-12-17 19:33 -0500
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-20 11:00 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 10:03 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-20 22:02 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-21 13:09 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-21 22:40 +0000
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-21 23:39 -0500
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-22 06:50 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-22 00:15 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-22 10:34 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-22 09:32 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-23 09:38 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-23 09:55 -0800
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-26 13:35 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-27 09:03 -0800
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-27 21:31 -0500
Re: Pointer Arithmetic & UB Philip Lantz <prl@canterey.us> - 2012-12-28 01:55 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-29 13:43 -0800
Re: Pointer Arithmetic & UB Philip Lantz <prl@canterey.us> - 2012-12-28 01:39 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-28 11:31 +0000
Re: Pointer Arithmetic & UB Keith Thompson <kst-u@mib.org> - 2012-12-28 08:47 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-29 17:45 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-30 04:06 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-02 10:08 -0800
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-26 13:29 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-27 07:55 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-27 08:01 -0800
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-27 21:10 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-29 18:03 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-23 03:48 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-23 10:22 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-27 10:34 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-27 10:16 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-10 17:26 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-12 12:38 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-12 20:50 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-13 13:07 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-13 22:11 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-14 11:11 -0800
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-12 18:32 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-13 00:34 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-13 16:40 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-14 00:01 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-13 19:20 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-14 01:03 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-13 20:41 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-14 03:19 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-13 23:36 -0500
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-13 23:43 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-14 13:20 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-14 20:02 -0500
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-15 21:20 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-14 10:23 -0800
Re: Pointer Arithmetic & UB 88888 Dihedral <dihedral88888@googlemail.com> - 2013-01-15 10:53 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-15 22:39 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-15 22:28 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-15 23:35 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-16 23:38 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-18 09:37 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-14 10:29 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-15 21:38 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-15 23:57 -0800
Re: Pointer Arithmetic & UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-01-16 15:34 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-16 11:15 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-16 10:28 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-16 19:09 +0000
Re: Pointer Arithmetic & UB Richard Damon <news.x.richarddamon@xoxy.net> - 2013-01-16 23:26 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-18 10:08 -0800
Re: Pointer Arithmetic & UB Keith Thompson <kst-u@mib.org> - 2013-01-18 11:33 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-18 14:00 -0800
Re: Pointer Arithmetic & UB Richard Damon <news.x.richarddamon@xoxy.net> - 2013-01-19 09:10 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-20 13:35 -0800
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-20 20:15 -0500
Re: Pointer Arithmetic & UB Richard Damon <news.x.richarddamon@xoxy.net> - 2013-01-20 21:05 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-21 09:43 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-18 11:13 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-18 20:59 +0000
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2013-01-18 16:24 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-19 00:17 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-19 11:22 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-20 14:51 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-21 00:07 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-21 10:05 -0800
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-01-21 20:19 +0000
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2013-01-21 23:20 -0800
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2013-01-18 17:48 -0500
Re: Pointer Arithmetic & UB 88888 Dihedral <dihedral88888@googlemail.com> - 2013-01-18 13:13 -0800
Re: Pointer Arithmetic & UB Robert Wessel <robertwessel2@yahoo.com> - 2012-12-20 12:21 -0600
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-20 13:40 -0500
Re: Pointer Arithmetic & UB Robert Wessel <robertwessel2@yahoo.com> - 2012-12-20 13:32 -0600
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-20 14:58 -0500
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-20 21:54 +0000
Re: Pointer Arithmetic & UB Lanarcam <lanarcam1@yahoo.fr> - 2012-12-20 19:49 +0100
Re: Pointer Arithmetic & UB Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-21 02:38 +0200
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-21 14:33 -0500
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2012-12-21 03:18 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-21 13:16 -0800
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2012-12-21 17:57 -0500
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-21 23:52 +0000
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2012-12-21 19:47 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-21 22:54 -0800
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2012-12-22 03:31 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-22 09:16 -0800
Re: Pointer Arithmetic & UB Shao Miller <sha0.miller@gmail.com> - 2012-12-24 04:23 -0500
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-27 11:07 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-17 02:33 -0800
Re: Pointer Arithmetic & UB Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-17 02:18 -0800
Re: Pointer Arithmetic & UB Noob <root@127.0.0.1> - 2012-12-11 11:36 +0100
Re: Pointer Arithmetic & UB "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-12-11 10:00 -0800
Re: Pointer Arithmetic & UB Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-17 12:11 +0200
Re: Pointer Arithmetic & UB Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-11 15:27 -0500
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-11 21:09 +0000
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-12 14:30 -0500
Re: Pointer Arithmetic & UB Keith Thompson <kst-u@mib.org> - 2012-12-12 11:42 -0800
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-12 17:12 -0500
Re: Pointer Arithmetic & UB Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-17 12:16 +0200
Re: Pointer Arithmetic & UB Prathamesh Kulkarni <bilbotheelffriend@gmail.com> - 2012-12-10 12:04 -0800
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-10 15:29 -0500
Re: Pointer Arithmetic & UB Prathamesh Kulkarni <bilbotheelffriend@gmail.com> - 2012-12-10 12:44 -0800
Re: Pointer Arithmetic & UB Prathamesh Kulkarni <bilbotheelffriend@gmail.com> - 2012-12-10 12:47 -0800
Re: Pointer Arithmetic & UB James Kuyper <jameskuyper@verizon.net> - 2012-12-10 16:02 -0500
Re: Pointer Arithmetic & UB Prathamesh Kulkarni <bilbotheelffriend@gmail.com> - 2012-12-10 13:08 -0800
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-12 14:26 -0500
Re: Pointer Arithmetic & UB Greg Martin <greg@softsprocket.com> - 2012-12-10 14:55 -0800
Re: Pointer Arithmetic & UB Sjouke Burry <s@b> - 2012-12-10 21:18 +0000
Re: Pointer Arithmetic & UB falk@rahul.net (Edward A. Falk) - 2012-12-11 00:48 +0000
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-10 21:01 +0000
Re: Pointer Arithmetic & UB Ken Brody <kenbrody@spamcop.net> - 2012-12-12 14:24 -0500
Re: Pointer Arithmetic & UB Robert Wessel <robertwessel2@yahoo.com> - 2012-12-12 14:34 -0600
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-12 20:45 +0000
Re: Pointer Arithmetic & UB Robert Wessel <robertwessel2@yahoo.com> - 2012-12-12 15:29 -0600
Re: Pointer Arithmetic & UB glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-12-13 02:02 +0000
Re: Pointer Arithmetic & UB Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-12-17 05:57 -0800
Re: Pointer Arithmetic & UB pete <pfiland@mindspring.com> - 2012-12-10 20:20 -0500
csiph-web