On 01/12/2026 20:57, Dan Cross wrote:
> In article <11em…@dont-email.me>,
> David Brown <davi…@hesbynett.no> wrote:
>> On 01/12/2026 00:54, Dan Cross wrote:
>>> In article <11ej…@dont-email.me>,
>>> Thomas Koenig <tkoe…@netcologne.de> wrote:
>>>> Dan Cross <cro…@spitfire.i.gajendra.net> schrieb:
>>>>
>>>>> Rules for undefined behavior in Fortran obviously different from
>>>>> those of C, since Fortran is a different langauge.
>>>>
>>>> Fortran has not concept of undefined behavior in the standard per se.
>>>
>>> It was pretty clear to me that the reference to UB in the ticket
>>> you linked to was just a shorthand.
>>>
>>>> It has correct code, code that violates numbered constraints (which
>>>> require a diagnostic) and code that violates a "shall" directive,
>>>> which is errouneous but for which no diagnostic is required.
>>>>
>>>> Integer overflow is among the restrictions that a processor (Fortran
>>>> standardese for the combination of compiler, run-time system etc) is
>>>> not required to catch, a.k.a. the programmer's fault. And Fortran
>>>> allows reassociation as long as parentheses are not violated.
>>>
>>> Ok. The point I was trying to make is that the context was not
>>> C; it was Fortran. Thus, references to whatever C's UB rules
>>> are don't really apply.
>>
>> While that's true, AFAIUI (and Thomas will hopefully correct me if I am
>> wrong!) the Fortran rules for signed and unsigned integer arithmetic
>> here are the same as for C. Fortran does not use the term "undefined
>> behaviour", but the meaning is the same. And in this particular case,
>> in both C and Fortran, addition is fully commutative and associative for
>> both signed and unsigned types in the standard language. It is only
>> when additional semantics are applied (such as trapping on overflow)
>> that there is any difference.
>
> Perhaps that's so, but it is, again, besides the point that I
> was making: suggesting that Thomas misunderstood the response on
> the bug and citing the rules of C is ironic, when the context
> was not C.
>
Agreed. Talking about C can make sense since a lot more people are familiar with the details of C than those of Fortran, but the post should have put in the connection (that the rules here are the same) rather than just changing languages.