Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Jon Chesterfield Newsgroups: comp.compilers Subject: Re: Re: Undefined Behavior Optimizations in C Date: Tue, 10 Jan 2023 10:46:32 +0000 Organization: Compilers Central Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-01-031@comp.compilers> References: <23-01-027@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="78830"; mail-complaints-to="abuse@iecc.com" Keywords: C, optimize Posted-Date: 10 Jan 2023 16:59:04 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: Xref: csiph.com comp.compilers:3299 > So before we decide if UB optimizations are actually allowed by the standard we need to decide what "ignoring the situation completely with unpredictable results" actually means. [1] https://port70.net/~nsz/c/c89/rationale/ Lucian WG14 are aware of UB optimising compilers and could have steered away from this path, but haven't. It's been decades now. The pointer provenance work seeks to apply aliasing rules even more aggressively. GCC and clang are both pursuing faster codegen via exploiting undefined behaviour. C, the WG14 ISO defined language, as implemented by the primary open source toolchains, is thus unfit for my purposes. I'm not clear what use that language has. C, the typed assembler of ye olde times, is a profoundly useful language. One just can't use GCC or clang to build it reliably. It annoys me intensely that the type aliasing rules capture something a whole program optimising compiler can usually work out for itself anyway, while preventing me from reading 128bit integers from the same memory I fetch_add 32bit integers into. Jon