🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #987

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

#987
From: Tim Rentsch
Date: Mon, 30 Nov 2026 14:48
55 lines
3663 bytes
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>>
>>> Thomas Koenig <tkoenig@netcologne.de> writes:
>>>
>>>> (from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128737 ).
>>>
>>> If the undefined behaviour nonsense would not be so sad, it
>>> would be funny.  The undefined behaviour advocates love to
>>> claim that undefined behaviour allows more optimization than
>>> defined behaviour, but in Comment 1 Richard Biener writes that
>>> gcc does not perform this optimization because of undefined
>>> behaviour.  [...]
>>
>> I suspect you are misunderstanding the meaning of RB's comment.
>
> The comment in it's entirety is:
>
> |probably a duplicate, the GIMPLE level re-association pass doesn't
> |consider signed integers (due to overflow UB)

I read the referenced bug report prior to posting my comments.

> He uses the word "due" and not "because", but it's clear that the
> reason he states for not performing this optimization is "overflow
> UB".

There is no question about what he wrote.  The question is what
was meant by it.

> In the part of my posting that you deleted, I discuss why the gcc
> maintainers may have decided not to reassociate in this case.

Yes, I read your entire posting.

>> The rules of C do not prohibit the optimization from being done.
>> gcc does not perform the transformation because of a choice gcc
>> has made about how code is compiled.
>
> This does not change anything about the fact that gcc does not
> reassociate the supposedly optimization-friendly overflow-UB
> integers, while it does reassociate integers where overflow is
> defined to perform modulo arithmetics.

I don't see any inconsistency between this statement and what I
wrote.

> And it does not change the fact that Richard Biener has written
> that gcc makes this choice "due to overflow UB".

Again, there is no question about what he wrote.  The question is
what was meant by it.
Technical Details
Message-ID: <86jylujryh.fsf@linuxsc.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-mail
References: <11cpqih$acf5$1@dont-email.me> <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me> <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com> <11csull$1ef6e$1@dont-email.me> <2026Nov9.230104@mips.complang.tuwien.ac.at> <11cvcr4$28k7g$1@dont-email.me> <11d3npt$3mmho$1@dont-email.me> <11dn936$2ebc2$1@dont-email.me> <11dndfd$2fr9j$1@dont-email.me> <2026Nov19.193817@mips.complang.tuwien.ac.at> <86o6b6kaqf.fsf@linuxsc.com> <2026Nov30.102207@mips.complang.tuwien.ac.at>

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: Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups: comp.arch
Subject: Re: reassociation and undefined behaviour (was: vector length CSR?)
Date: Mon, 30 Nov 2026 06:48:22 -0800
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <86jylujryh.fsf@linuxsc.com>
References: <11cpqih$acf5$1@dont-email.me> <sgu0flpndaqltpdbft40fghmi7vk78q2hs@4ax.com> <11cq2v7$dh5b$1@dont-email.me> <8jk1fl182pskj3fsmp4ju6qf420pgl0htg@4ax.com> <11csull$1ef6e$1@dont-email.me> <2026Nov9.230104@mips.complang.tuwien.ac.at> <11cvcr4$28k7g$1@dont-email.me> <11d3npt$3mmho$1@dont-email.me> <11dn936$2ebc2$1@dont-email.me> <11dndfd$2fr9j$1@dont-email.me> <2026Nov19.193817@mips.complang.tuwien.ac.at> <86o6b6kaqf.fsf@linuxsc.com> <2026Nov30.102207@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 30 Nov 2026 14:48:24 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="560674"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18DiPezveov8XqXW3uBPrbOfkhbx4UcnYI="; posting-host="14b2dabe2e9870fe799d0b4575e040c3"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:viC4TvidhBOW259oh61BuDReHtM=
	sha1:/AqqDoyk0w34oJXjjDgP2dEYIDI= sha256:AUynEhC5B1LYCKzv5GHH55qKIaDEYKB3VPw942/mzfM=
	sha1:lw8NK7fyMCWd9rNI/y64mdVxmB0= sha256:DlxF5HXlHogjf9KunHOmQAYkeWsunHAIw59GL6hO9/o=