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

Compiler Crashes when trying to create a label in inline assembler with macros. #53787

Closed
FabianB1998 opened this issue Aug 29, 2018 · 9 comments · Fixed by #57747
Closed

Compiler Crashes when trying to create a label in inline assembler with macros. #53787

FabianB1998 opened this issue Aug 29, 2018 · 9 comments · Fixed by #57747
Labels
A-inline-assembly Area: inline asm!(..) A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@FabianB1998
Copy link

FabianB1998 commented Aug 29, 2018

Compiler Crashes when trying to create a label in inline assembler with macros. I am not sure if my could would work, but I am pretty sure it should not crash the compiler.

I tried this code: https://pastebin.com/pxCPeQnt

https://pastebin.com/WK4ydW8i
This does not crash, it seems it is somehow relating to the input formatting

I expected to see this happen: Generate a code sample with the given id
Instead, this happened: Compiler crashes

rustc --version --verbose:

rustc 1.30.0-nightly (73c7873 2018-08-05)
binary: rustc
commit-hash: 73c7873
commit-date: 2018-08-05
host: x86_64-pc-windows-msvc
release: 1.30.0-nightly
LLVM version: 7.0

Backtrace:
https://hastebin.com/xeyokeriqo.rb or https://pastebin.com/gDAvd4wQ
(Github keeps messing with the windows formatting)

@estebank
Copy link
Contributor

playground:

error: internal compiler error: librustc_codegen_llvm/mir/operand.rs:145: not immediate: OperandRef(Pair(([0 x i8]*:[0 x i8]* bitcast (<{ [9 x i8] }>* @1 to [0 x i8]*)), (i64:i64 9)) @ TyLayout { ty: &str, details: LayoutDetails { variants: Single { index: 0 }, fields: Arbitrary { offsets: [Size { raw: 0 }, Size { raw: 8 }], memory_index: [0, 1] }, abi: ScalarPair(Scalar { value: Pointer, valid_range: 1..=18446744073709551615 }, Scalar { value: Int(I64, false), valid_range: 0..=18446744073709551615 }), align: Align { abi_pow2: 3, pref_pow2: 3 }, size: Size { raw: 16 } } })

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:587:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error

@estebank estebank added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-inline-assembly Area: inline asm!(..) A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Aug 29, 2018
@levex
Copy link
Contributor

levex commented Oct 20, 2018

Fixed by #54747, no longer reproduces on the playground by @estebank . Also, the span will be improved by #55087. Thanks!

@estebank
Copy link
Contributor

@levex could you add a test for this repro case? The only thing left to close this ticket is a repro test in the repo to avoid regressions.

@estebank estebank added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. labels Oct 22, 2018
@levex
Copy link
Contributor

levex commented Oct 23, 2018

@estebank sure i'll take this. ETA this week.

@AB1908
Copy link

AB1908 commented Jan 15, 2019

@levex could you add a test for this repro case? The only thing left to close this ticket is a repro test in the repo to avoid regressions.

@estebank: If I RTFMed correctly, I think the test should be a compile-fail type which should be added according to the test adding guide. Is this correct?

@estebank
Copy link
Contributor

@AB1908 almost, we're phasing compile-fail away, being subsumed by ui tests. You can create .stderr files for your new tests using ./x.py test src/test/ui --stage1 --bless.

@AB1908
Copy link

AB1908 commented Jan 15, 2019 via email

@estebank
Copy link
Contributor

So do I go ahead and create a regular test and then use x.py?

Correct. That will compile the compiler, run the tests and update the .stderr files that the test suite compares against. Then the tests get run again to compare the json output against the comments (like //^ ERROR error desc).

Also, how was I supposed to find out about the phasing out of compile-fail?

@AB1908 I think there hasn't been a hard policy announced, but that's the direction we're going in.

https://rust-lang.github.io/rustc-guide/tests/adding.html#what-kind-of-test-should-i-add
#53353
#44844

@AB1908
Copy link

AB1908 commented Jan 16, 2019

I think that should do it.

Centril added a commit to Centril/rust that referenced this issue Jan 18, 2019
bors added a commit that referenced this issue Jan 18, 2019
Rollup of 11 pull requests

Successful merges:

 - #57107 (Add a regression test for mutating a non-mut #[thread_local])
 - #57132 (Document that `-C opt-level=0` implies `-C debug-assertions`.)
 - #57212 (docs(rustc): Link to the book's source in rustc)
 - #57302 (Fix unused_assignments false positive)
 - #57350 (Better error note on unimplemented Index trait for string)
 - #57635 (use structured macro and path resolve suggestions)
 - #57650 (librustc_metadata: Pass a default value when unwrapping a span)
 - #57657 (Add regression test to close #53787)
 - #57658 (Two HIR tweaks)
 - #57720 (Fix suggestions given mulitple bad lifetimes)
 - #57725 (Use structured suggestion to surround struct literal with parenthesis)

Failed merges:

r? @ghost
VardhanThigle pushed a commit to jethrogb/rust that referenced this issue Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: inline asm!(..) A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants