basic VRP min/max range overflow question
Paul Schlie
schlie@comcast.net
Sat Jun 18 18:50:00 GMT 2005
So in effect the standard committee have chosen to allow any program which
invokes any undefined behavior to behave arbitrarily without diagnosis?
This is a good thing?
[ curiously can't find any actual reference stating that integer overflow
is specifically results in undefined behavior, although it's obviously ill
defined?
although can find reference that a dereference of an overflowed pointer
is undefined? ]
> From: "Joseph S. Myers" <joseph@codesourcery.com>
> On Sat, 18 Jun 2005, Paul Schlie wrote:
>
>> [#1] Behavior, upon use of a nonportable or erroneous
>> program construct, of erroneous data, or of indeterminately
>> valued objects, for which this International Standard
>> imposes no requirements. Permissible undefined behavior
>> ranges from ignoring the situation completely with
>> unpredictable results, to behaving during translation or
>> program execution in a documented manner characteristic of
>> the environment (with or without the issuance of a
>> diagnostic message), to terminating a translation or
>> execution (with the issuance of a diagnostic message).
>
> You appear to have chosen to misquote again. In this case, you've taken
> the C90 version of the wording but with a paragraph number from C99 (C90
> did not have paragraph numbers). Perhaps you cannot grasp the generality
> of "no requirements"? A few examples are given, but "no requirements"
> means that the program can behave completely inconsistently if it involves
> undefined behavior.
>
>> [#3] The implementation must successfully translate a given
>> program unless a syntax error is detected, a constraint is
>> violated, or it can determine that every possible execution
>> of that program would result in undefined behavior.
>
> This looks like a completely fabricated quote to me. If it comes from
> C99, state the subclause and paragraph numbers (in C99 as amended by TC1
> and TC2). It certainly doesn't seem to be in the plain text version of
> C99+TC1. In general, state where you are quoting rather than just
> claiming particular text you've just written is relevant.
>
>> Which again is specific to that which is defined, as it requires the
>> successful (and presumably conformant) translation of the program unless
>> the implementation can prove the whole program is itself would have an
>> undefined behavior (reinforcing the notion that the language's semantics
>> remain in force even in the presence of a expression with undefined
>> semantics).
>
> "no requirements" means that *any* translation conforms in the case of
> undefined behavior. Only those executions not involving undefined
> behavior have any requirements.
>
> --
> Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
> jsm@polyomino.org.uk (personal mail)
> joseph@codesourcery.com (CodeSourcery mail)
> jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
More information about the Gcc
mailing list