Deutsch   English   Français   Italiano  
<vb3k0m$1rth7$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Thomas Koenig <tkoenig@netcologne.de>
Newsgroups: comp.arch
Subject: Re: Computer architects leaving Intel...
Date: Mon, 2 Sep 2024 05:55:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <vb3k0m$1rth7$1@dont-email.me>
References: <2024Aug30.161204@mips.complang.tuwien.ac.at>
 <memo.20240830164247.19028y@jgd.cix.co.uk> <vasruo$id3b$1@dont-email.me>
 <2024Aug30.195831@mips.complang.tuwien.ac.at> <vat5ap$jthk$2@dont-email.me>
 <vaunhb$vckc$1@dont-email.me> <vautmu$vr5r$1@dont-email.me>
 <2024Aug31.170347@mips.complang.tuwien.ac.at>
 <vavpnh$13tj0$2@dont-email.me> <vb2hir$1ju7q$1@dont-email.me>
 <8lcadjhnlcj5se1hrmo232viiccjk5alu4@4ax.com>
Injection-Date: Mon, 02 Sep 2024 07:55:34 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8931b5407bde990b59eec3041f2a60a5";
	logging-data="1963559"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19X7uWkpv3LphSPHXhLpr6j+jU4dUmtTcs="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:nOz2T6jH7JS21osMhZPtWSDqBMU=
Bytes: 3305

George Neuner <gneuner2@comcast.net> schrieb:

> I'm not going to argue about whether UB in code is wrong.  The
> question I have concerns what to do with something that explicitly is
> mentioned as UB in some standard N, but was not addressed in previous
> standards.
>
> Was it always UB?  Or should it be considered ID until it became UB?

Can you give an exapmple?

I would say this really depends on the circumstances.  If it is
something left unspecified by earlier standards, and put into the
list of undefined behavior as a clarification, that is one thing.

If it is something that was previosly well-defined and then made
into undefined behavior, that is another thing; I would then
likely consider it a bug in the standard (but again, depending
on the circumstances).


> It does seem to me that as the C standard evolved, and as more things
> have *explicitly* become documented as UB, compiler developers have
> responded largely by dropping whatever the compiler did previously -
> sometimes breaking code that relied on it.

There's a reason that there is a "porting to" file for each release
of gcc; in a way, each release can be considered a new compiler.

As an example, here's an entry from
https://gcc.gnu.org/gcc-13/porting_to.html :

# Fortran language issues

# Behavior on integer overflow

# GCC 13 includes new optimizations which may change behavior on
# integer overflow. Traditional code, like linear congruential
# pseudo-random number generators in old programs and relying on
# a specific, non-standard behavior may now generate unexpected
# results. The option -fsanitize=undefined can be used to detect
# such code at runtime.
# 
# It is recommended to use the intrinsic subroutine RANDOM_NUMBER for
# random number generators or, if the old behavior is desired, to use
# the -fwrapv option. Note that this option can impact performance.

Integer overflow on multiplication had always been illegal in
Fortran (prohibited by "shall not"), but it had widely been used
anyway.  That was a though one...