Sujet : Re: Computer architects leaving Intel...
De : monnier (at) *nospam* iro.umontreal.ca (Stefan Monnier)
Groupes : comp.archDate : 03. Sep 2024, 20:06:38
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <jwved60o8y7.fsf-monnier+comp.arch@gnu.org>
References : 1 2 3 4 5 6 7 8
User-Agent : Gnus/5.13 (Gnus v5.13)
Undefined behaviour is something that is exercised at run-time.
That's why the "undefined behaviour sanitizers" insert run-time
checks. And of course they only detect the behaviour when it is
actually exercised.
IIUC the way the run-time checks need to *prevent* undefined behavior
rather than merely detecting it, because if you do
if (would_UB_here())
fprintf (stderr, ...);
maybe_do_UB_here();
the compiler is allowed to skip the `fprintf` if `maybe_do_UB_here`
does UB. IOW the UB effect can be "retroactive".
Stefan