Sujet : Re: Computer architects leaving Intel...
De : cr88192 (at) *nospam* gmail.com (BGB)
Groupes : comp.archDate : 03. Sep 2024, 19:39:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vb7l56$3eh1o$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Mozilla Thunderbird
On 9/2/2024 8:36 AM, MitchAlsup1 wrote:
On Mon, 2 Sep 2024 5:55:34 +0000, Thomas Koenig wrote:
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?
Memcopy() with overlapping pointers.
I had just recently discovered that newer versions of GCC will cause code to break if it is missing a return value in C++ mode.
So:
int Foo() { }
Will (in theory) cause the program to crash when called (emitting a 'UD2' instruction), except in WSL it seems this doesn't quite work correctly (the UD2 doesn't result in an immediate crash), and the program seemingly instead "goes off the rails and crashes at a later point" (GCC omits the epilog when it does this, and seemingly control flow then goes into whatever function follows in the binary, crashing when that function tries to return seemingly by branching to an invalid address or similar).
This was mostly effecting "init" functions in my Verilator test benches...
Well, that, and a more inconsistent variant, where if one declares struct fields as 8 and 3 bytes and then strncpy's 11 bytes into the combined field, it may also insert a UD2 and skip emitting the following code.
...
But, yeah, that was annoying...