Deutsch   English   Français   Italiano  
<jwv7cbxq2xb.fsf-monnier+comp.arch@gnu.org>

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

Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: comp.arch
Subject: Re: Computer architects leaving Intel...
Date: Fri, 30 Aug 2024 14:34:23 -0400
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <jwv7cbxq2xb.fsf-monnier+comp.arch@gnu.org>
References: <2024Aug30.161204@mips.complang.tuwien.ac.at>
	<memo.20240830164247.19028y@jgd.cix.co.uk>
	<vasruo$id3b$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Fri, 30 Aug 2024 20:34:26 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="73155664f8445d1bc45a0301bc10774b";
	logging-data="640027"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+iblaNHv15UjI4aFLE6dy2ZyFvuRBb4wY="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:wcm/VYMmDfCu3MM+ZuuIenhoWpM=
	sha1:S1VKL1qJFtBzr7C/Azs5F/hQmOg=
Bytes: 1985

> If you want to write reliable code that can be distributed as source and
> compiled by any conforming C/C++ compiler, you need to be very sure that you
> avoid relying on behaviour that is not specified and documented. You need to
> write correct code.  That means if you want to copy some memory with
> overlapping source and destination arrays, you use "memmove" - the function
> for that purpose.  You don't use "memcpy", since it is specified explicitly
> as requiring non-overlapping arrays.

The difficulty here is that the tools provide very little help for that,
because all too often it's virtually impossible for the tools to
understand that this particular code can/will hit UB.

So it's all up to the programmer, who often doesn't know either.
Other than using CompCert, I don't know of any reliable way for
a programmer to make sure his C code does not suffer from UB.


        Stefan