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

LLVM assertion failure when compiling winapi with the latest nightly #35991

Closed
CensoredUsername opened this issue Aug 25, 2016 · 20 comments
Closed
Assignees
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@CensoredUsername
Copy link
Contributor

When compiling a project that depends on winapi on the latest nightly, the compilation halts due to an llvm assertion failure while winapi is being built.

Error message:

Assertion failed: !isa<DIType>(Scope) && "shouldn't make a namespace scope for a type", file C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\llvm\lib\CodeGen\AsmPrinter\CodeViewDebug.cpp, line 202

Toolchain/platform info

rustc --version
rustc 1.13.0-nightly (e9bc1bac8 2016-08-24)

toolchain: nightly-x86_64-pc-windows-msvc

winapi version: v0.2.8
winapi-build version: v0.1.1
@alexcrichton
Copy link
Member

cc @eddyb, MIR related?

@eddyb
Copy link
Member

eddyb commented Aug 25, 2016

Doubtful, especially if the previous nightly worked. cc @rust-lang/compiler

@ruuda
Copy link
Contributor

ruuda commented Aug 25, 2016

I am seeing the same error when compiling scoped_threadpool, see this ci build. It’s compiling Convector 209010ec with rustc 1.13.0-nightly (e9bc1bac8 2016-08-24) on Windows.

@eddyb
Copy link
Member

eddyb commented Aug 25, 2016

@ruuda Did it start on that nightly, i.e. does it work with the previous nightly?

@ruuda
Copy link
Contributor

ruuda commented Aug 25, 2016

@eddyb: The previous ci build is a bit older, it was 1.13.0-nightly (f883b0bba 2016-08-19), and it passed. I could try to reproduce locally. Are older nightly installers archived somewhere?

@eddyb
Copy link
Member

eddyb commented Aug 25, 2016

If you use rustup you can just pick a date, or you can download manually.
Given the commit range, this could be #35764, although it's not clear to me how, just yet.

@eddyb eddyb added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 25, 2016
@TimNN
Copy link
Contributor

TimNN commented Aug 25, 2016

For scoped_threadpool, nightly-2016-08-23 is fine while nightly-2016-08-25 failes.

@TimNN
Copy link
Contributor

TimNN commented Aug 25, 2016

Minimal repro (even on non-windows platforms with cargo +nightly-2016-08-25 build --target i686-pc-windows-msvc):

struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {
        panic!();
    }
}

@TimNN
Copy link
Contributor

TimNN commented Aug 25, 2016

i686-pc-windows-gnu is fine, i686-pc-windows-msvc fails.

@TimNN
Copy link
Contributor

TimNN commented Aug 25, 2016

Even smaller:

fn bar() {
    panic!();
}

@retep998
Copy link
Member

I am legitimately wondering how this could get past CI when we have auto-win-msvc-64-cargotest which builds the latest winapi among other crates.

@eddyb
Copy link
Member

eddyb commented Aug 25, 2016

@retep998 The bots don't have LLVM assertions enabled 😿.

@nrc
Copy link
Member

nrc commented Aug 25, 2016

discussed briefly at the compiler meeting, leaving to eddyb to investigate before we can make any decision

@nrc nrc added P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed I-nominated labels Aug 25, 2016
@arielb1
Copy link
Contributor

arielb1 commented Aug 25, 2016

This only breaks with debuginfo enabled.

STR:

#![crate_type="rlib"]

pub fn unwind() {
    panic!()
}
$ $RUSTC -V
rustc 1.13.0-dev (528c6f3ed 2016-08-25)
$ $RUSTC panic.rs --target=i686-pc-windows-msvc -L. -g

# *** IR Dump Before Insert XRay ops ***:
# Machine code for function _ZN3std9panicking11begin_panic17h015847775f0133acE: Properties: <Post SSA, tracking liveness, AllVRegsAllocated>
Frame Objects:
  fi#-7: size=4, align=4, fixed, at location [SP-16]
  fi#-6: size=4, align=4, fixed, at location [SP-12]
  fi#-5: size=4, align=4, fixed, at location [SP-8]
  fi#-4: size=4, align=4, fixed, at location [SP-4]
  fi#-3: size=4, align=4, fixed, at location [SP+12]
  fi#-2: size=4, align=4, fixed, at location [SP+8]
  fi#-1: size=4, align=4, fixed, at location [SP+4]
  fi#0: size=16, align=4, at location [SP-32]
  fi#1: size=8, align=4, at location [SP-40]
  fi#2: size=8, align=4, at location [SP-48]
  fi#3: size=8, align=4, at location [SP-56]
  fi#4: size=4, align=4, at location [SP-60]
  fi#5: size=8, align=4, at location [SP-68]
  fi#6: size=4, align=4, at location [SP-72]
  fi#7: size=4, align=4, at location [SP-76]

BB#0: derived from LLVM BB %entry-block
    Live Ins: %EBX %EDI %ESI %EBP
    PUSH32r %EBP<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    %EBP<def> = MOV32rr %ESP; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    PUSH32r %EBX<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    PUSH32r %EDI<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    PUSH32r %ESI<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    %ESP<def,tied1> = SUB32ri8 %ESP<tied0>, 72, %EFLAGS<imp-def,dead>; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    %EAX<def> = MOV32rm %EBP, 1, %noreg, 16, %noreg; mem:LD4[FixedStack-3]
    %ECX<def> = MOV32rm %EBP, 1, %noreg, 12, %noreg; mem:LD4[FixedStack-2]
    %EDX<def> = MOV32rm %EBP, 1, %noreg, 8, %noreg; mem:LD4[FixedStack-1]
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect
    DBG_VALUE %EBP, -56, !"file_line", <!69>; line no:1 indirect
    %ESI<def> = MOV32rr %ESP
    MOV32mr %EBP, 1, %noreg, -28, %noreg, %ESI<kill>; mem:ST4[%6]
    MOV32mi %EBP, 1, %noreg, -16, %noreg, -1; mem:ST4[%7]
    %ESI<def> = LEA32r %EBP, 1, %noreg, -24, %noreg
    MOV32mi %EBP, 1, %noreg, -20, %noreg, <ga:@"__ehhandler$_ZN3std9panicking11begin_panic17h015847775f0133acE">; mem:ST4[%9]
    %EDI<def> = MOV32rm %noreg, 1, %noreg, 0, %FS; mem:LD4[null(addrspace=257)]
    MOV32mr %EBP, 1, %noreg, -24, %noreg, %EDI<kill>; mem:ST4[%11]
    MOV32mr %noreg, 1, %noreg, 0, %FS, %ESI<kill>; mem:ST4[null(addrspace=257)]
    MOV32mr %EBP, 1, %noreg, -52, %noreg, %EDX<kill>; mem:ST4[%12]
    MOV32mr %EBP, 1, %noreg, -48, %noreg, %ECX<kill>; mem:ST4[%13]
    MOV32mr %EBP, 1, %noreg, -56, %noreg, %EAX<kill>; mem:ST4[%arg1]
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -52, %noreg; mem:LD4[%14] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %ECX<def> = MOV32rm %EBP, 1, %noreg, -48, %noreg; mem:LD4[%15] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    MOV32mr %EBP, 1, %noreg, -64, %noreg, %EAX<kill>; mem:ST4[%18] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    MOV32mr %EBP, 1, %noreg, -60, %noreg, %ECX<kill>; mem:ST4[%19] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -56, %noreg; mem:LD4[%arg1] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    MOV32mr %EBP, 1, %noreg, -68, %noreg, %EAX<kill>; mem:ST4[%file_line] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -64, %noreg; mem:LD4[%21] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %ECX<def> = MOV32rm %EBP, 1, %noreg, -60, %noreg; mem:LD4[%22] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %EBP, 1, %noreg, -36, %noreg, %EAX<kill>; mem:ST4[%25](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %EBP, 1, %noreg, -32, %noreg, %ECX; mem:ST4[%26](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -36, %noreg; mem:LD4[%27](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:235 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EBP, 1, %noreg, -44, %noreg, %EAX<kill>; mem:ST4[%31](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:235 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EBP, 1, %noreg, -40, %noreg, %ECX<kill>; mem:ST4[%32](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:235 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mi %EBP, 1, %noreg, -16, %noreg, 0; mem:ST4[%33] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %EAX<def> = MOV32rr %ESP; dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mi %EAX, 1, %noreg, 4, %noreg, 4; mem:ST4[Stack+4] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mi %EAX<kill>, 1, %noreg, 0, %noreg, 8; mem:ST4[Stack] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    CALLpcrel32 <ga:@_ZN5alloc4heap15exchange_malloc17hc245874b0fa682bdE>, <regmask>, %ESP<imp-use>, %ESP<imp-def>, %EAX<imp-def>; dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EBP, 1, %noreg, -72, %noreg, %EAX<kill>; mem:ST4[FixedStack7] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    JMP_1 <BB#1>; dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    Successors according to CFG: BB#1 BB#2

BB#1: derived from LLVM BB %"_ZN5alloc5boxed30_$LT$impl$u20$Box$LT$T$GT$$GT$3new17h3c9ec2d8f3bff52dE.exit"
    Live Ins: %EBP
    Predecessors according to CFG: BB#0
    DBG_VALUE %EBP, -56, !"file_line", <!69>; line no:1 indirect
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -44, %noreg; mem:LD4[%36](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %ECX<def> = MOV32rm %EBP, 1, %noreg, -40, %noreg; mem:LD4[%37](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %EDX<def> = MOV32rm %EBP, 1, %noreg, -72, %noreg; mem:LD4[FixedStack7] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EDX, 1, %noreg, 0, %noreg, %EAX<kill>; mem:ST4[%40] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EDX, 1, %noreg, 4, %noreg, %ECX<kill>; mem:ST4[%41] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -68, %noreg; mem:LD4[%file_line] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %ECX<def> = MOV32rr %ESP; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %ECX, 1, %noreg, 8, %noreg, %EAX<kill>; mem:ST4[Stack+8] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %ECX, 1, %noreg, 0, %noreg, %EDX<kill>; mem:ST4[Stack] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mi %ECX<kill>, 1, %noreg, 4, %noreg, <ga:@vtable6152>; mem:ST4[Stack+4] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    CALLpcrel32 <ga:@_ZN3std9panicking20rust_panic_with_hook17h94399962be666930E>, <regmask>, %ESP<imp-use>, %ESP<imp-def>; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %ESP<def,tied1> = SUB32ri8 %ESP<tied0>, 12, %EFLAGS<imp-def,dead>; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    JMP_1 <BB#3>; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    Successors according to CFG: BB#3 BB#2

BB#3: derived from LLVM BB %unreachable
    Live Ins: %EBP
    Predecessors according to CFG: BB#1
    DBG_VALUE %EBP, -56, !"file_line", <!69>; line no:1 indirect
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect

BB#2: derived from LLVM BB %bb1, EH LANDING PAD
    Live Ins: %EBP
    Predecessors according to CFG: BB#0 BB#1
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect
    PUSH32r %EBP<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    %ESP<def,tied1> = SUB32ri8 %ESP<tied0>, 12, %EFLAGS<imp-def,dead>; flags: FrameSetup dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EBP<def,tied1> = ADD32ri8 %EBP<tied0>, 12, %EFLAGS<imp-def,dead>; flags: FrameSetup
    %ESP<def,tied1> = ADD32ri8 %ESP<tied0>, 12, %EFLAGS<imp-def,dead>; flags: FrameDestroy dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EBP<def> = POP32r %ESP<imp-def>, %ESP<imp-use>; flags: FrameDestroy dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    CLEANUPRET; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376

# End machine code for function _ZN3std9panicking11begin_panic17h015847775f0133acE.

# *** IR Dump Before Implement the 'patchable-function' attribute ***:
# Machine code for function _ZN3std9panicking11begin_panic17h015847775f0133acE: Properties: <Post SSA, tracking liveness, AllVRegsAllocated>
Frame Objects:
  fi#-7: size=4, align=4, fixed, at location [SP-16]
  fi#-6: size=4, align=4, fixed, at location [SP-12]
  fi#-5: size=4, align=4, fixed, at location [SP-8]
  fi#-4: size=4, align=4, fixed, at location [SP-4]
  fi#-3: size=4, align=4, fixed, at location [SP+12]
  fi#-2: size=4, align=4, fixed, at location [SP+8]
  fi#-1: size=4, align=4, fixed, at location [SP+4]
  fi#0: size=16, align=4, at location [SP-32]
  fi#1: size=8, align=4, at location [SP-40]
  fi#2: size=8, align=4, at location [SP-48]
  fi#3: size=8, align=4, at location [SP-56]
  fi#4: size=4, align=4, at location [SP-60]
  fi#5: size=8, align=4, at location [SP-68]
  fi#6: size=4, align=4, at location [SP-72]
  fi#7: size=4, align=4, at location [SP-76]

BB#0: derived from LLVM BB %entry-block
    Live Ins: %EBX %EDI %ESI %EBP
    PUSH32r %EBP<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    %EBP<def> = MOV32rr %ESP; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    PUSH32r %EBX<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    PUSH32r %EDI<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    PUSH32r %ESI<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    %ESP<def,tied1> = SUB32ri8 %ESP<tied0>, 72, %EFLAGS<imp-def,dead>; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    %EAX<def> = MOV32rm %EBP, 1, %noreg, 16, %noreg; mem:LD4[FixedStack-3]
    %ECX<def> = MOV32rm %EBP, 1, %noreg, 12, %noreg; mem:LD4[FixedStack-2]
    %EDX<def> = MOV32rm %EBP, 1, %noreg, 8, %noreg; mem:LD4[FixedStack-1]
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect
    DBG_VALUE %EBP, -56, !"file_line", <!69>; line no:1 indirect
    %ESI<def> = MOV32rr %ESP
    MOV32mr %EBP, 1, %noreg, -28, %noreg, %ESI<kill>; mem:ST4[%6]
    MOV32mi %EBP, 1, %noreg, -16, %noreg, -1; mem:ST4[%7]
    %ESI<def> = LEA32r %EBP, 1, %noreg, -24, %noreg
    MOV32mi %EBP, 1, %noreg, -20, %noreg, <ga:@"__ehhandler$_ZN3std9panicking11begin_panic17h015847775f0133acE">; mem:ST4[%9]
    %EDI<def> = MOV32rm %noreg, 1, %noreg, 0, %FS; mem:LD4[null(addrspace=257)]
    MOV32mr %EBP, 1, %noreg, -24, %noreg, %EDI<kill>; mem:ST4[%11]
    MOV32mr %noreg, 1, %noreg, 0, %FS, %ESI<kill>; mem:ST4[null(addrspace=257)]
    MOV32mr %EBP, 1, %noreg, -52, %noreg, %EDX<kill>; mem:ST4[%12]
    MOV32mr %EBP, 1, %noreg, -48, %noreg, %ECX<kill>; mem:ST4[%13]
    MOV32mr %EBP, 1, %noreg, -56, %noreg, %EAX<kill>; mem:ST4[%arg1]
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -52, %noreg; mem:LD4[%14] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %ECX<def> = MOV32rm %EBP, 1, %noreg, -48, %noreg; mem:LD4[%15] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    MOV32mr %EBP, 1, %noreg, -64, %noreg, %EAX<kill>; mem:ST4[%18] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    MOV32mr %EBP, 1, %noreg, -60, %noreg, %ECX<kill>; mem:ST4[%19] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -56, %noreg; mem:LD4[%arg1] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    MOV32mr %EBP, 1, %noreg, -68, %noreg, %EAX<kill>; mem:ST4[%file_line] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -64, %noreg; mem:LD4[%21] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %ECX<def> = MOV32rm %EBP, 1, %noreg, -60, %noreg; mem:LD4[%22] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %EBP, 1, %noreg, -36, %noreg, %EAX<kill>; mem:ST4[%25](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %EBP, 1, %noreg, -32, %noreg, %ECX; mem:ST4[%26](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -36, %noreg; mem:LD4[%27](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:235 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EBP, 1, %noreg, -44, %noreg, %EAX<kill>; mem:ST4[%31](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:235 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EBP, 1, %noreg, -40, %noreg, %ECX<kill>; mem:ST4[%32](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:235 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mi %EBP, 1, %noreg, -16, %noreg, 0; mem:ST4[%33] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %EAX<def> = MOV32rr %ESP; dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mi %EAX, 1, %noreg, 4, %noreg, 4; mem:ST4[Stack+4] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mi %EAX<kill>, 1, %noreg, 0, %noreg, 8; mem:ST4[Stack] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    CALLpcrel32 <ga:@_ZN5alloc4heap15exchange_malloc17hc245874b0fa682bdE>, <regmask>, %ESP<imp-use>, %ESP<imp-def>, %EAX<imp-def>; dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EBP, 1, %noreg, -72, %noreg, %EAX<kill>; mem:ST4[FixedStack7] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    JMP_1 <BB#1>; dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    Successors according to CFG: BB#1 BB#2

BB#1: derived from LLVM BB %"_ZN5alloc5boxed30_$LT$impl$u20$Box$LT$T$GT$$GT$3new17h3c9ec2d8f3bff52dE.exit"
    Live Ins: %EBP
    Predecessors according to CFG: BB#0
    DBG_VALUE %EBP, -56, !"file_line", <!69>; line no:1 indirect
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -44, %noreg; mem:LD4[%36](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %ECX<def> = MOV32rm %EBP, 1, %noreg, -40, %noreg; mem:LD4[%37](noalias=!106) dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %EDX<def> = MOV32rm %EBP, 1, %noreg, -72, %noreg; mem:LD4[FixedStack7] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EDX, 1, %noreg, 0, %noreg, %EAX<kill>; mem:ST4[%40] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    MOV32mr %EDX, 1, %noreg, 4, %noreg, %ECX<kill>; mem:ST4[%41] dbg:/opt/rust/build-debug-assertions/t/../../src/liballoc/boxed.rs:236 @[ /opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384 ]
    %EAX<def> = MOV32rm %EBP, 1, %noreg, -68, %noreg; mem:LD4[%file_line] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %ECX<def> = MOV32rr %ESP; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %ECX, 1, %noreg, 8, %noreg, %EAX<kill>; mem:ST4[Stack+8] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mr %ECX, 1, %noreg, 0, %noreg, %EDX<kill>; mem:ST4[Stack] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    MOV32mi %ECX<kill>, 1, %noreg, 4, %noreg, <ga:@vtable6152>; mem:ST4[Stack+4] dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    CALLpcrel32 <ga:@_ZN3std9panicking20rust_panic_with_hook17h94399962be666930E>, <regmask>, %ESP<imp-use>, %ESP<imp-def>; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    %ESP<def,tied1> = SUB32ri8 %ESP<tied0>, 12, %EFLAGS<imp-def,dead>; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    JMP_1 <BB#3>; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:384
    Successors according to CFG: BB#3 BB#2

BB#3: derived from LLVM BB %unreachable
    Live Ins: %EBP
    Predecessors according to CFG: BB#1
    DBG_VALUE %EBP, -56, !"file_line", <!69>; line no:1 indirect
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect

BB#2: derived from LLVM BB %bb1, EH LANDING PAD
    Live Ins: %EBP
    Predecessors according to CFG: BB#0 BB#1
    DBG_VALUE %EBP, -52, !"msg", <!69>; line no:1 indirect
    PUSH32r %EBP<kill>, %ESP<imp-def>, %ESP<imp-use>; flags: FrameSetup
    CFI_INSTRUCTION <call frame instruction>
    CFI_INSTRUCTION <call frame instruction>
    %ESP<def,tied1> = SUB32ri8 %ESP<tied0>, 12, %EFLAGS<imp-def,dead>; flags: FrameSetup dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EBP<def,tied1> = ADD32ri8 %EBP<tied0>, 12, %EFLAGS<imp-def,dead>; flags: FrameSetup
    %ESP<def,tied1> = ADD32ri8 %ESP<tied0>, 12, %EFLAGS<imp-def,dead>; flags: FrameDestroy dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    %EBP<def> = POP32r %ESP<imp-def>, %ESP<imp-use>; flags: FrameDestroy dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376
    CLEANUPRET; dbg:/opt/rust/build-debug-assertions/t/../../src/libstd/panicking.rs:376

# End machine code for function _ZN3std9panicking11begin_panic17h015847775f0133acE.

rustc: /opt/rust/src/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:202: llvm::codeview::TypeIndex llvm::CodeViewDebug::getScopeIndex(const llvm::DIScope*): Assertion `!isa<DIType>(Scope) && "shouldn't make a namespace scope for a type"' failed.
#1  0x00007f3e0a02664a in __GI_abort () at abort.c:89
#2  0x00007f3e0a01e107 in __assert_fail_base (fmt=<optimized out>, 
    assertion=assertion@entry=0x7f3e060f10b8 "!isa<DIType>(Scope) && \"shouldn't make a namespace scope for a type\"", 
    file=file@entry=0x7f3e060f0e88 "/opt/rust/src/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp", 
    line=line@entry=202, 
    function=function@entry=0x7f3e060f8cc0 <llvm::CodeViewDebug::getScopeIndex(llvm::DIScope const*)::__PRETTY_FUNCTION__> "llvm::codeview::TypeIndex llvm::CodeViewDebug::getScopeIndex(const llvm::DIScope*)") at assert.c:92
#3  0x00007f3e0a01e1b2 in __GI___assert_fail (
    assertion=0x7f3e060f10b8 "!isa<DIType>(Scope) && \"shouldn't make a namespace scope for a type\"", 
    file=0x7f3e060f0e88 "/opt/rust/src/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp", line=202, 
    function=0x7f3e060f8cc0 <llvm::CodeViewDebug::getScopeIndex(llvm::DIScope const*)::__PRETTY_FUNCTION__> "llvm::codeview::TypeIndex llvm::CodeViewDebug::getScopeIndex(const llvm::DIScope*)") at assert.c:101
#4  0x00007f3e04e61054 in llvm::CodeViewDebug::getScopeIndex(llvm::DIScope const*) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#5  0x00007f3e04e66650 in llvm::CodeViewDebug::getFuncIdForSubprogram(llvm::DISubprogram const*) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#6  0x00007f3e04e6a7cc in llvm::CodeViewDebug::getInlineSite(llvm::DILocation const*, llvm::DISubprogram const*) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#7  0x00007f3e04e6ab52 in llvm::CodeViewDebug::maybeRecordLocation(llvm::DebugLoc const&, llvm::MachineFunction const*) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#8  0x00007f3e04e6acff in llvm::CodeViewDebug::beginInstruction(llvm::MachineInstr const*) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#9  0x00007f3e04e014e9 in llvm::AsmPrinter::EmitFunctionBody() ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#10 0x00007f3e044e08ac in llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#11 0x00007f3e04fb4b65 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#12 0x00007f3e057a2f63 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#13 0x00007f3e057a331b in llvm::FPPassManager::runOnModule(llvm::Module&) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#14 0x00007f3e057a3651 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so
#15 0x00007f3e044ad564 in LLVMRustWriteOutputFile ()
   from /opt/rust/build-debug-assertions/build/x86_64-unknown-linux-gnu/stage1/bin/../lib/../lib/librustc_llvm-d57d2b4ceb3a380c.so

@eddyb
Copy link
Member

eddyb commented Aug 25, 2016

@arielb1 Don't think the machine IR dump is relevant. @TimNN provided before and after IR on IRC.
It's probably the use of the original DefId instead of an inlined one, to get the DefPath, that triggers this.

@michaelwoerister
Copy link
Member

Has LLVM been updated in the meanwhile? Maybe this assertion is new. We might be adding methods to basic types which doesn't seem to be allowed (anymore?).

@eddyb
Copy link
Member

eddyb commented Aug 26, 2016

@michaelwoerister Main difference AFAICT is that {inlined-root} is gone, having been replaced by the correct path and I don't know of a LLVM update.

@michaelwoerister
Copy link
Member

Well, for reference, there's #33358, which kind of looks relevant. But it's strange that it should become a problem now.

@eddyb
Copy link
Member

eddyb commented Aug 26, 2016

Does fn main() { Box::new("foo"); } also fail? The metadata for 3 fn has scope pointing to a type:

!31 = !DICompositeType(tag: DW_TAG_structure_type, name: "TypeId", scope: !27, file: !8, size: 64, align: 64, elements: !32, identifier: "{struct core/1b4950c20447afca23a796609deae33a2e5e010df8c7a3efd1aeadd01355b84e/68dc}")
!64 = distinct !DISubprogram(name: "of<&str>", linkageName: "_ZN4core3any8{{impl}}8of<&str>E", scope: !31, file: !25, line: 381, type: !65, isLocal: false, isDefinition: true, scopeLine: 381, flags: DIFlagPrototyped, isOptimized: false, unit: !0, templateParams: !36, variables: !2)

!72 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*mut u8", baseType: !17, size: 32, align: 32)
!70 = distinct !DISubprogram(name: "is_null<u8>", linkageName: "_ZN4core3ptr8{{impl}}11is_null<u8>E", scope: !72, file: !71, line: 367, type: !73, isLocal: false, isDefinition: true, scopeLine: 367, flags: DIFlagPrototyped, isOptimized: false, unit: !0, templateParams: !76, variables: !2)

!146 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Box<&str>", baseType: !13, size: 32, align: 32)
!144 = distinct !DISubprogram(name: "new<&str>", linkageName: "_ZN5alloc5boxed8{{impl}}9new<&str>E", scope: !146, file: !145, line: 235, type: !147, isLocal: false, isDefinition: true, scopeLine: 235, flags: DIFlagPrototyped, isOptimized: false, unit: !0, templateParams: !36, variables: !2)

@eddyb
Copy link
Member

eddyb commented Aug 26, 2016

The failure suggests #33358 shouldn't have worked. It didn't work, or regressed, in cross-crate cases.
But did this ever work?

#![crate_type = "lib"]
pub struct Foo;
impl Foo {
    pub fn foo() {}
}
pub fn bar() {
    Foo::foo();
}

AFAICT it would cause the exact same problem after the LLVM upgrade, which is in beta.

EDIT: Mystery elucidated: CodeView support in LLVM only allows "class" methods:

  if (const auto *Class = dyn_cast_or_null<DICompositeType>(Scope)) {
    // If the scope is a DICompositeType, then this must be a method. Member
    // function types take some special handling, and require access to the
    // subprogram.

The reason it hasn't been observed yet is two-fold: only inherent methods of types that are not structs, enums or tuples would trigger the problem, and cross-crate metadata regressed to {inlined-root}.
Therefore, the only way to reproduce this between #33358 and #35764 (which fixed cross-crate debuginfo) would've been to compile libcore with CodeView output. Preparing a PR now.

bors added a commit that referenced this issue Aug 26, 2016
Do not emit "class method" debuginfo for types that are not DICompositeType.

Fixes #35991 by restricting the "class method" debuginfo sugar from #33358 to structs and enums only.

r? @michaelwoerister
chalcolith added a commit to chalcolith/ponyc that referenced this issue Nov 19, 2017
…ods.

Following [Rust's solution](rust-lang/rust#35991 (comment)), we make a dummy scope for primitive methods.

This change also reorders some imports in codegen.h and gendebug.cc, as gendebug.h now depends on having PONY_LLVM defined.
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-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants