This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: dewar at gnat dot com
- To: dewar at gnat dot com, mrs at windriver dot com, paulus at samba dot org
- Cc: gcc at gcc dot gnu dot org, linux-kernel at vger dot kernel dot org,trini at kernel dot crashing dot org, velco at fadata dot bg
- Date: Tue, 8 Jan 2002 19:51:35 -0500 (EST)
- Subject: Re: [PATCH] C undefined behavior fix
<<Hum, where in that standard does it say that the compiler won't
scribble all over memory? If it doesn't, does that mean that within
the confines of the language standard that the compiler can? If you
produce an Ada compiler that did, do you think your users would feel
better when you told them you were allowed to by the language
standard?
>>
YOu are appealing to the "intent" of the C standard to say that when
referencing volatile memory, ONLY the volatile variable can be
referenced and nothing else. OK, but where do you find this intent?
Or do we just have to take Mike's word for it? If so, that's not
very helpful (i.e. to consider that there is an implicit clause
in the standard that says to consult Mike to learn the intent of
anything not spelled out).
Seriously, I just don't see the requirement stated or implied in the
standard. Perhaps I am missing some language, that's certainly possible,
it is not a document that I know by heart beginning to end.
As to your question above, the external effects of an Ada program are very
carefully stated in the standard, and no one is allowed to try to extend
this set of effects by appealing to "intent". Of course marketing requirements
say many things, e.g. you can obviously compute A+B by recursive incrementing,
and of course that satisfies the standard, but it is obviously useless.
Now if you are claiming that generating efficient code to access a 16-bit
volatile quantity (by loading 32 bits) is in the same category, I absolutely
do not buy that at all.