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.
>> C came up in this context as a parenthetical, "if one considers
>> the assembly equivalent of this...". Here, it was clear that C
>> syntax was merely used as a pseudocode. Arguments about C's
>> behavior and definition are beside the point.
>
>There are a few points to consider here. Gcc is fairly C-centric,
>even now. Also, tools like the sanitizers could cause problems
>with integer reassociation.
Ok, but that's a different matter.
>But I have been thinking about introducing a -freassoc-integer
>flag to gcc, and enabling it by default by gfortran. Maybe at
>the beginning of stage 1 for gcc 18.
Cool.
- Dan C.