🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #986

Re: reassociation and undefined behaviour (was: vector length CSR?)

#986
From: Thomas Koenig
Date: Mon, 30 Nov 2026 13:29
32 lines
2662 bytes
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.
>
> 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.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Technical Details
Message-ID: <11ejtoe$eoj7$1@dont-email.me>
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
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>

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: Thomas Koenig <tkoenig@netcologne.de>
Newsgroups: comp.arch
Subject: Re: reassociation and undefined behaviour (was: vector length CSR?)
Date: Mon, 30 Nov 2026 13:29:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <11ejtoe$eoj7$1@dont-email.me>
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>
Injection-Date: Mon, 30 Nov 2026 13:29:51 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="483943"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/q87Ii1dRxFCMRdnPxjKaX6eRcbiK/Sgg="; posting-host="c9843ac806dda957f005300aaf4401ab"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:DbzZ08rgnuB3IsBoAbQQW802QKg= sha256:bi1+XetXqua+sPQIRNI6aKW4UvNorLrMBwxHYQfkfO8=
	sha1:Vo/Zrpst7rN5zqKmMDuYqCuO05M= sha256:g5pwncrPq3WGLHcLTDP5m9rnco18PNV1JZ9LgVzLYDM=