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

zero-length static array triggers LLVM assertion error on windows #13793

Closed
klutzy opened this issue Apr 27, 2014 · 6 comments
Closed

zero-length static array triggers LLVM assertion error on windows #13793

klutzy opened this issue Apr 27, 2014 · 6 comments
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows

Comments

@klutzy
Copy link
Contributor

klutzy commented Apr 27, 2014

pub static A: &'static [int] = &[];

pub fn main() {
}
Assertion failed!

Program: d:\usr\rust\bin\rustc.exe
File: c:/bot/slave/nightly-win/build/src/llvm/lib/MC/WinCOFFObjectWriter.cpp, Line 224

Expression: Section->Number != -1 && "Sections with relocations must be real!"

Original: rustc --test empty.rs triggers LLVM assertion error on windows

$ touch empty.rs
$ rustc --test empty.rs

Assertion failed!

Program: c:\home\stone\rust-vanilla\build\i686-pc-mingw32\stage2\bin\rustc.exe
File: c:/home/stone/rust-vanilla/src/llvm/lib/MC/WinCOFFObjectWriter.cpp, Line 222

Expression: Section->Number != -1 && "Sections with relocations must be real!"

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
@klutzy
Copy link
Contributor Author

klutzy commented Apr 27, 2014

Same error for make check-stage2-regex_macros.
This blocks make check on windows: cc #12745 #13439

@alexcrichton
Copy link
Member

cc #10872

@klutzy klutzy changed the title rustc --test empty.rs triggers LLVM assertion error on windows zero-length array triggers LLVM assertion error on windows May 5, 2014
@klutzy
Copy link
Contributor Author

klutzy commented May 5, 2014

Updated title and minimal example. (was: rustc --test empty.rs triggers LLVM assertion error on windows)

--test generates pub static TESTS: &'static [self::test::TestDescAndFn] = &[]; which cause error.

@klutzy
Copy link
Contributor Author

klutzy commented May 5, 2014

Other example:

fn f(_a: &[int]) {
}

fn main() {
    static A: [int, ..0u] = [];
    f(A); // triggers assertion
}

This example is derived from println!("");.

@klutzy klutzy changed the title zero-length array triggers LLVM assertion error on windows zero-length static array triggers LLVM assertion error on windows May 5, 2014
@alexcrichton
Copy link
Member

Interestingly, if you go from rustc to an object, then the assertion is triggered. If you go from rustc to IR to an object (through llc), no assertion is triggered.

Maybe we've set up LLVM incorrectly?

@klutzy
Copy link
Contributor Author

klutzy commented May 27, 2014

upstream llvm bug: http://llvm.org/bugs/show_bug.cgi?id=18993

@brson brson mentioned this issue Aug 12, 2014
33 tasks
bors added a commit that referenced this issue Aug 18, 2014
First commit enables regex test on Windows. It was not working at some point (#13725), but it works now.

Second commit removes various FIXMEs regarding #13793, since upstream bug has been fixed.
@bors bors closed this as completed in 4806746 Aug 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

3 participants