Thus, instead of the desired effects, the above code panics with the message 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0xdeadbeef'.
Fortunately, the author chose the value 42 such that it fits in an u8, facilitating an easy fix without the need to invent another funny address that would additionally be 8-byte aligned ;)
The English blog text does not mention the type of the pointer so I assume that neither do the translations.
EDIT 2023-05-31:
I just noticed that post 8 is affected by this as well (as already discussed in #1215) and applied the same fix there.
In the "Double Faults" post, the following code is given as an example:
Dereferencing
0xdeadbeef
as any type larger thanu8
is undefined behavior, and a recently merged PR for Rust added runtime debug assertions for this.Thus, instead of the desired effects, the above code panics with the message
'misaligned pointer dereference: address must be a multiple of 0x8 but is 0xdeadbeef'
.Fortunately, the author chose the value
42
such that it fits in anu8
, facilitating an easy fix without the need to invent another funny address that would additionally be 8-byte aligned ;)The English blog text does not mention the type of the pointer so I assume that neither do the translations.