Article View: comp.arch
Article #995Re: reassociation and undefined behaviour (was: vector length CSR?)
From: Dan Cross
Date: Mon, 30 Nov 2026 23:54
Date: Mon, 30 Nov 2026 23:54
44 lines
2654 bytes
2654 bytes
In article <11ejtoe$eoj7$1@dont-email.me>, Thomas Koenig <tkoenig@netcologne.de> wrote: >Dan Cross <cross@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.
Technical Details
Message-ID:
<11el2c1$q43$1@reader2.panix.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <86o6b6kaqf.fsf@linuxsc.com> <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail From: cross@spitfire.i.gajendra.net (Dan Cross) Newsgroups: comp.arch Subject: Re: reassociation and undefined behaviour (was: vector length CSR?) Date: Mon, 30 Nov 2026 23:54:41 -0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: <11el2c1$q43$1@reader2.panix.com> References: <11cpqih$acf5$1@dont-email.me> <86o6b6kaqf.fsf@linuxsc.com> <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me> Injection-Date: Mon, 30 Nov 2026 23:54:41 -0000 (UTC) Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80"; logging-data="26755"; mail-complaints-to="abuse@panix.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: cross@spitfire.i.gajendra.net (Dan Cross)