ant…@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> Tim Rentsch <tr.1…@z991.linuxsc.com> writes:
>
>> ant…@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>>
>>> Thomas Koenig <tkoe…@netcologne.de> writes:
>>>
>>>> (from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128737 ).
>>>
>>> If the undefined behaviour nonsense would not be so sad, it
>>> would be funny. The undefined behaviour advocates love to
>>> claim that undefined behaviour allows more optimization than
>>> defined behaviour, but in Comment 1 Richard Biener writes that
>>> gcc does not perform this optimization because of undefined
>>> behaviour. [...]
>>
>> I suspect you are misunderstanding the meaning of RB's comment.
>
> The comment in it's entirety is:
>
> |probably a duplicate, the GIMPLE level re-association pass doesn't
> |consider signed integers (due to overflow UB)
I read the referenced bug report prior to posting my comments.
> He uses the word "due" and not "because", but it's clear that the
> reason he states for not performing this optimization is "overflow
> UB".
There is no question about what he wrote. The question is what
was meant by it.
> In the part of my posting that you deleted, I discuss why the gcc
> maintainers may have decided not to reassociate in this case.
Yes, I read your entire posting.
>> The rules of C do not prohibit the optimization from being done.
>> gcc does not perform the transformation because of a choice gcc
>> has made about how code is compiled.
>
> This does not change anything about the fact that gcc does not
> reassociate the supposedly optimization-friendly overflow-UB
> integers, while it does reassociate integers where overflow is
> defined to perform modulo arithmetics.
I don't see any inconsistency between this statement and what I
wrote.
> And it does not change the fact that Richard Biener has written
> that gcc makes this choice "due to overflow UB".
Again, there is no question about what he wrote. The question is
what was meant by it.