Skip to content

incorrect UB when when a ! place is constructed (but not loaded!) #117288

@RalfJung

Description

@RalfJung

This code shouldn't have UB but Miri reports UB and rustc generates a SIGILL:

#![feature(never_type)] fn main() { unsafe { let x = 3u8; let x: *const ! = &x as *const u8 as *const _; let _ = *x; } }

Thanks to @Nadrieril for finding this.

Zulip discussion

Metadata

Metadata

Labels

F-never_type`#![feature(never_type)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamT-opsemRelevant to the opsem teamrequires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions