Article View: comp.arch
Article #993Re: reassociation and undefined behaviour (was: vector length CSR?)
From: Michael S
Date: Mon, 30 Nov 2026 22:01
Date: Mon, 30 Nov 2026 22:01
37 lines
2931 bytes
2931 bytes
On Mon, 30 Nov 2026 13:29:50 -0000 (UTC) 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 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. In more simple words, in case of arithmetic operations on signed integers there is no semantical difference between C and Fortran. > > > > 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. > > 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. >
Technical Details
Message-ID:
<20261201000100.00004bb5@yahoo.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <11dndfd$2fr9j$1@dont-email.me> <2026Nov19.193817@mips.complang.tuwien.ac.at> <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!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.arch Subject: Re: reassociation and undefined behaviour (was: vector length CSR?) Date: Tue, 1 Dec 2026 00:01:00 +0200 Organization: A noiseless patient Spider Lines: 37 Message-ID: <20261201000100.00004bb5@yahoo.com> References: <11cpqih$acf5$1@dont-email.me> <11dndfd$2fr9j$1@dont-email.me> <2026Nov19.193817@mips.complang.tuwien.ac.at> <86o6b6kaqf.fsf@linuxsc.com> <11ejr5e$nk8$1@reader2.panix.com> <11ejtoe$eoj7$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Mon, 30 Nov 2026 22:00:59 +0000 (UTC) Injection-Info: dont-email.me; logging-data="877015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OPo4OCa9AXsFJ/rFVZAz+DPktH/XzLrQ="; posting-host="af37ef6e2a2298e04b8c13cc1e0c97d7" Cancel-Lock: sha1:he3PTO5JD5jFW/7yRXPQr94MkK4= sha256:6D1Z3IH4mBNM13EI5bKl1LSilt5jQh139El0zalitWU= sha1:B/G5yzsdZSYYue6weoZ84nUQwLo= sha256:IsasSJvu+kpncRH6ebgiMnabesV5eh6QE1FBPNzT2Wk= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)