Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type validation failed: encountered NULL reference at [2].0 #56800

Closed
saethlin opened this issue Dec 14, 2018 · 4 comments · Fixed by #56919
Closed

type validation failed: encountered NULL reference at [2].0 #56800

saethlin opened this issue Dec 14, 2018 · 4 comments · Fixed by #56919
Assignees
Labels
P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@saethlin
Copy link
Member

Minimized as best I could:

fn main() {
    let mut headers = Vec::new();
    headers.extend_from_slice(&[("", ""); 3]);
}

With rustc 1.32.0-nightly (f4a421ee3 2018-12-13)
Full error:

ERROR 2018-12-14T02:46:10Z: rustc_mir::interpret::validity: Bits { size: 8, bits: 0 } is not aligned to Align { pow2: 0 }
error[E0080]: it is undefined behavior to use this value
 --> src/main.rs:1:1
  |
1 | / fn main() {
2 | |     let mut headers = Vec::new();
3 | |     headers.extend_from_slice(&[("", ""); 3]);
4 | | }
  | |_^ type validation failed: encountered NULL reference at [2].0
  |
  = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
@Centril Centril added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. regression-from-stable-to-beta Performance or correctness regression from stable to beta. P-high High priority labels Dec 15, 2018
@Centril
Copy link
Contributor

Centril commented Dec 15, 2018

cc @pnkfelix @RalfJung @nikomatsakis

@RalfJung
Copy link
Member

Cc @oli-obk

@RalfJung
Copy link
Member

Even more minimal example:

fn main() {
    let _ = &[("", ""); 3];
}

@oli-obk oli-obk self-assigned this Dec 15, 2018
@oli-obk oli-obk added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Dec 17, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Dec 17, 2018

Const eval is drunk (note the gap of relocations between the second and fourth element and again after the fourth elemen):

Alloc 7:    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (160 bytes, alignment 8) (stack)
            └─────────(2)─────────┘                         └─────────(3)─────────┘                         └─────────(2)─────────┘                         └─────────(3)─────────┘                                                                                                                         └─────────(2)─────────┘                         └─────────(3)─────────┘ 

Validation is doing everything correctly

pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 20, 2018
…fJung

Remove a wrong multiplier on relocation offset computation

r? @RalfJung

fixes rust-lang#56800
@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 20, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Dec 21, 2018
…fJung

Remove a wrong multiplier on relocation offset computation

r? @RalfJung

fixes rust-lang#56800
pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 21, 2018
…fJung

Remove a wrong multiplier on relocation offset computation

r? @RalfJung

fixes rust-lang#56800
Centril added a commit to Centril/rust that referenced this issue Dec 22, 2018
…fJung

Remove a wrong multiplier on relocation offset computation

r? @RalfJung

fixes rust-lang#56800
kennytm added a commit to kennytm/rust that referenced this issue Dec 22, 2018
…fJung

Remove a wrong multiplier on relocation offset computation

r? @RalfJung

fixes rust-lang#56800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants