coercion of mutable pointers' child type causes a soundness issue #20738
Labels
bug
Observed behavior contradicts documented or intended behavior
miscompilation
The compiler reports success but produces semantically incorrect code.
Milestone
Zig Version
0.14.0-dev.367+a57479afc
Steps to Reproduce and Observed Behavior
Attempt to compile the following code:
The code compiles without errors.
Expected Behavior
The code should have triggered a compilation error.
A mutable pointer to (one / many / slice / C) a type
T
can coerce into a mutable pointer of typeU
without soundness problems if-and-only-if:T
andU
are in-memory coercible, andThese are, I believe, the most liberal coercion rules that do not result in soundness problems - I will leave the discussion about whether Zig should be this liberal with its coercion rules to another issue.
The text was updated successfully, but these errors were encountered: