Date: Wed, 14 Mar 2018 18:50:57 -0400
On Wed, Mar 14, 2018 at 5:52 PM, Hyman Rosen <hyman.rosen_at_[hidden]> wrote:
> On Wed, Mar 14, 2018 at 5:37 PM, Aaron Ballman <aaron_at_[hidden]>
> wrote:
>>
>> On Wed, Mar 14, 2018 at 5:30 PM, Hyman Rosen <hyman.rosen_at_[hidden]>
>> wrote:
>> > No behavior should ever be designated undefined in order to allow
>> > optimizers to generate code by assuming that the behavior never occurs.
>>
>> Infinite loops are a counter-example to this assertion.
>
>
> How so?
Infinite loops are undefined behavior because you'd have to solve the
halting problem in order to determine whether any given code path is
dynamically reachable. So presence of an infinite loop is UB in order
to allow optimizers to generate code assuming the behavior never
occurs.
~Aaron
> On Wed, Mar 14, 2018 at 5:37 PM, Aaron Ballman <aaron_at_[hidden]>
> wrote:
>>
>> On Wed, Mar 14, 2018 at 5:30 PM, Hyman Rosen <hyman.rosen_at_[hidden]>
>> wrote:
>> > No behavior should ever be designated undefined in order to allow
>> > optimizers to generate code by assuming that the behavior never occurs.
>>
>> Infinite loops are a counter-example to this assertion.
>
>
> How so?
Infinite loops are undefined behavior because you'd have to solve the
halting problem in order to determine whether any given code path is
dynamically reachable. So presence of an infinite loop is UB in order
to allow optimizers to generate code assuming the behavior never
occurs.
~Aaron
Received on 2018-03-14 23:50:59