[LLVMdev] C as used/implemented in practice: analysis of responses

David Keaton dmk at dmk.com
Fri Jul 3 07:49:54 PDT 2015


On 07/03/2015 03:33 AM, Renato Golin wrote:
> On 3 July 2015 at 05:17, David Keaton <dmk at dmk.com> wrote:
>>> Consider:
>>> y is positive
>>> a = x + y (signed overflow, wrapping "expected")
>>> if (a >= x)
>>>     store out of bounds
>>> ===>
>>> store out of bounds
>>
>>
>>       Right.  This is not prevented because the programmer has specified an
>> out-of-bounds store.  However, if the programmer had not done so, the
>> implementation would be prevented from making a transformation that results
>> in an out-of-bounds store.
>
> As is most of the original questions that had any traction. All
> related to odd pointer handling (position, arithmetic, representation,
> lifetime, etc), which all (?) end up as critical undefined behaviour.

      Those are not critical.  This means that under Annex L, the 
bounded undefined behavior can no longer be assumed away by an 
optimization.  However, if invalid pointer values are later 
dereferenced, that later action can be critical.

					David




More information about the llvm-dev mailing list