basic VRP min/max range overflow question
Dale Johannesen
dalej@apple.com
Sat Jun 18 01:10:00 GMT 2005
On Jun 17, 2005, at 5:59 PM, Paul Schlie wrote:
>> From: Andrew Pinski <pinskia@physics.uc.edu>
>> On Jun 17, 2005, at 8:20 PM, Paul Schlie wrote:
>>
>>> ["undefined" only provides liberties within the constrains of what
>>> is specifically specified as being undefined, but none beyond
>>> that.]
>>
>> That is not true. Undefined means it can run "rm /" if you ever
>> invoke
>> the undefined code.
>
> - If the semantics of an operation are "undefined", I'd agree; but if
> control is returned to the program, the program's remaining specified
> semantics must be correspondingly obeyed, including the those which
> may utilize the resulting value of the "undefined" operation.
>
> - If the result value is "undefined", just the value is undefined.
>
> (Unless one advocates that any undefined result implies undefined
> semantics,
> which enables anything to occur, including the arbitrary corruption of
> the remaining program's otherwise well defined semantics; in which
> case any
> invocation of implementation specific behavior may then validly result
> in
> arbitrary remaining program behavior.)
>
> Which I'd hope isn't advocated.
You are wrong, and this really isn't a matter of opinion. The standard
defines exactly
what it means by "undefined behavior":
3.4.3 1 undefined behavior
behavior, upon use of a nonportable or erroneous program construct or
of erroneous data,
for which this International Standard imposes no requirements
2 NOTE Possible 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).
More information about the Gcc
mailing list