Skip to content
New issue

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

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

Already on GitHub? # to your account

Compilation fails without error message #41139

Closed
memoryleak47 opened this issue Apr 7, 2017 · 4 comments
Closed

Compilation fails without error message #41139

memoryleak47 opened this issue Apr 7, 2017 · 4 comments
Assignees
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. 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

@memoryleak47
Copy link
Contributor

This rust code fails in compilation without error message:

trait Trait {}

fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }

fn main() {
        let t : &Trait = &get_function()();
}

When compiling with cargo build --verbose I get:

   Compiling errroom v0.1.0 (file:///home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom)
     Running `rustc --crate-name errroom main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=23eb45247c97d4cd -C extra-filename=-23eb45247c97d4cd --out-dir /home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps -L dependency=/home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps`
warning: unused variable: `t`, #[warn(unused_variables)] on by default
 --> main.rs:6:6
  |
6 | 	let t : &Trait = &get_function()();
  | 	    ^

error: Could not compile `errroom`.

Caused by:
  process didn't exit successfully: `rustc --crate-name errroom main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=23eb45247c97d4cd -C extra-filename=-23eb45247c97d4cd --out-dir /home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps -L dependency=/home/memoryleak47/projects/mind/srl/lawsets/b.3/errroom/target/debug/deps` (exit code: 1)

rustc --version --verbose:

rustc 1.16.0 (30cf806ef 2017-03-10)
binary: rustc
commit-hash: 30cf806ef8881c41821fbd43e5cf3699c5290c16
commit-date: 2017-03-10
host: x86_64-unknown-linux-gnu
release: 1.16.0
LLVM version: 3.9
@jonas-schievink
Copy link
Contributor

According to the Playpen, this actually segfaults the compiler (on all channels). Doing a Release build reveals why (on stable and beta):

Incorrect number of arguments passed to called function!
  invoke void @_ZN4drop17hd8e1ea93099f8185E(i8* %8)
          to label %bb3 unwind label %cleanup
LLVM ERROR: Broken function found, compilation aborted!

On nightly, the error is different (since LLVM assertions are enabled, even though they don't catch the error in debug builds):

rustc: /checkout/src/llvm/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::Constant; From = llvm::Value]: Assertion `Val && "isa<> used on a null pointer"' failed.
Aborted (core dumped)

@TimNN TimNN added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Apr 7, 2017
@TimNN
Copy link
Contributor

TimNN commented Apr 7, 2017

This is a regression form 1.11 to 1.12, likely introduced by mir -- 1.12 + -Zorbit=off doesn't reproduce.

@TimNN
Copy link
Contributor

TimNN commented Apr 7, 2017

Backtrace on nightly:

#3  0x00007f2d7175ec62 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007f2d6baaaee6 in llvm::cast_retty<llvm::Constant, llvm::Value*>::ret_type llvm::dyn_cast<llvm::Constant, llvm::Value>(llvm::Value*) ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_llvm-3aedc27cea629d08.so
#5  0x00007f2d6ca47371 in LLVMBuildInBoundsGEP () from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_llvm-3aedc27cea629d08.so
#6  0x00007f2d712890fa in rustc_trans::builder::Builder::gepi ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#7  0x00007f2d712ba6d2 in rustc_trans::meth::VirtualIndex::get_fn ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#8  0x00007f2d712c4155 in rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_block ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#9  0x00007f2d712bf0d1 in rustc_trans::mir::trans_mir () from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#10 0x00007f2d712e33dd in rustc_trans::trans_item::TransItem::define ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#11 0x00007f2d7127f74e in rustc_trans::base::trans_crate::trans_def_task ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#12 0x00007f2d7122b85b in rustc::dep_graph::graph::DepGraph::with_task ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#13 0x00007f2d71279f7b in rustc_trans::base::trans_crate ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_trans-8524c596fdbfd5aa.so
#14 0x00007f2d71f7f97a in rustc_driver::driver::phase_4_translate_to_llvm ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so
#15 0x00007f2d71f3df49 in rustc_driver::driver::compile_input::{{closure}} ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so
#16 0x00007f2d71f6c8e6 in rustc_driver::driver::phase_3_run_analysis_passes::{{closure}} ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so
#17 0x00007f2d71eada73 in rustc::ty::context::TyCtxt::create_and_enter ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so
#18 0x00007f2d71f5a9bf in rustc_driver::driver::phase_3_run_analysis_passes ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so
#19 0x00007f2d71f33e80 in rustc_driver::driver::compile_input ()
   from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so
#20 0x00007f2d71f93d8c in rustc_driver::run_compiler () from /home/logic/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-0f4024af7b82b2df.so

@arielb1
Copy link
Contributor

arielb1 commented Apr 7, 2017

This is not supposed to compile. We are taking a reference to an unsized rvalue, which is silly.

@bors bors closed this as completed in 0144613 Apr 12, 2017
jieyouxu added a commit to jieyouxu/rust that referenced this issue Feb 5, 2025
Rename and Move some UI tests to more suitable subdirs

## Affected Tests
- tests/ui/issues/issue-48838.rs -> tests/ui/enum/closure-in-enum-issue-48838.rs rust-lang#48838
- tests/ui/issues/issue-40350.rs -> tests/ui/enum/enum-inside-enum-issue-40350.rs rust-lang#40350
- tests/ui/issues/issue-41272.rs -> tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs rust-lang#41272
- tests/ui/issues/issue-40408.rs -> tests/ui/lexer/floating-point-0e10-issue-40408.rs rust-lang#40408
- tests/ui/issues/issue-40136.rs -> tests/ui/macros/const-expr-invocations-issue-40136.rs rust-lang#40136
- tests/ui/issues/issue-40845.rs -> tests/ui/macros/macros-in-trait-positions-issue-40845.rs rust-lang#40845
- tests/ui/issues/issue-41213.rs -> tests/ui/match/enum-and-break-in-match-issue-41213.rs rust-lang#41213
- tests/ui/issues/issue-40782.rs -> tests/ui/suggestions/for-loop-missing-in.rs rust-lang#40782
- tests/ui/issues/issue-40827.rs -> tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs rust-lang#40827
- tests/ui/issues/issue-40610.rs -> tests/ui/typeck/coercion-check-for-addition-issue-40610.rs rust-lang#40610
- tests/ui/issues/issue-40883.rs -> tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs rust-lang#40883
- tests/ui/issues/issue-40861.rs -> tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs rust-lang#40861
- tests/ui/issues/issue-41139.rs -> tests/ui/typeck/unsized-rvalue-issue-41139.rs rust-lang#41139
- tests/ui/issues/issue-40749.rs -> tests/ui/wf/range-expr-root-of-constant-issue-40749.rs rust-lang#40749
- tests/ui/issues/issue-40235.rs -> tests/ui/while/while-let-scope-issue-40235.rs rust-lang#40235
jieyouxu added a commit to jieyouxu/rust that referenced this issue Feb 5, 2025
Rename and Move some UI tests to more suitable subdirs

## Affected Tests
- tests/ui/issues/issue-48838.rs -> tests/ui/enum/closure-in-enum-issue-48838.rs rust-lang#48838
- tests/ui/issues/issue-40350.rs -> tests/ui/enum/enum-inside-enum-issue-40350.rs rust-lang#40350
- tests/ui/issues/issue-41272.rs -> tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs rust-lang#41272
- tests/ui/issues/issue-40408.rs -> tests/ui/lexer/floating-point-0e10-issue-40408.rs rust-lang#40408
- tests/ui/issues/issue-40136.rs -> tests/ui/macros/const-expr-invocations-issue-40136.rs rust-lang#40136
- tests/ui/issues/issue-40845.rs -> tests/ui/macros/macros-in-trait-positions-issue-40845.rs rust-lang#40845
- tests/ui/issues/issue-41213.rs -> tests/ui/match/enum-and-break-in-match-issue-41213.rs rust-lang#41213
- tests/ui/issues/issue-40782.rs -> tests/ui/suggestions/for-loop-missing-in.rs rust-lang#40782
- tests/ui/issues/issue-40827.rs -> tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs rust-lang#40827
- tests/ui/issues/issue-40610.rs -> tests/ui/typeck/coercion-check-for-addition-issue-40610.rs rust-lang#40610
- tests/ui/issues/issue-40883.rs -> tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs rust-lang#40883
- tests/ui/issues/issue-40861.rs -> tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs rust-lang#40861
- tests/ui/issues/issue-41139.rs -> tests/ui/typeck/unsized-rvalue-issue-41139.rs rust-lang#41139
- tests/ui/issues/issue-40749.rs -> tests/ui/wf/range-expr-root-of-constant-issue-40749.rs rust-lang#40749
- tests/ui/issues/issue-40235.rs -> tests/ui/while/while-let-scope-issue-40235.rs rust-lang#40235
jieyouxu added a commit to jieyouxu/rust that referenced this issue Feb 5, 2025
Rename and Move some UI tests to more suitable subdirs

## Affected Tests
- tests/ui/issues/issue-48838.rs -> tests/ui/enum/closure-in-enum-issue-48838.rs rust-lang#48838
- tests/ui/issues/issue-40350.rs -> tests/ui/enum/enum-inside-enum-issue-40350.rs rust-lang#40350
- tests/ui/issues/issue-41272.rs -> tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs rust-lang#41272
- tests/ui/issues/issue-40408.rs -> tests/ui/lexer/floating-point-0e10-issue-40408.rs rust-lang#40408
- tests/ui/issues/issue-40136.rs -> tests/ui/macros/const-expr-invocations-issue-40136.rs rust-lang#40136
- tests/ui/issues/issue-40845.rs -> tests/ui/macros/macros-in-trait-positions-issue-40845.rs rust-lang#40845
- tests/ui/issues/issue-41213.rs -> tests/ui/match/enum-and-break-in-match-issue-41213.rs rust-lang#41213
- tests/ui/issues/issue-40782.rs -> tests/ui/suggestions/for-loop-missing-in.rs rust-lang#40782
- tests/ui/issues/issue-40827.rs -> tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs rust-lang#40827
- tests/ui/issues/issue-40610.rs -> tests/ui/typeck/coercion-check-for-addition-issue-40610.rs rust-lang#40610
- tests/ui/issues/issue-40883.rs -> tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs rust-lang#40883
- tests/ui/issues/issue-40861.rs -> tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs rust-lang#40861
- tests/ui/issues/issue-41139.rs -> tests/ui/typeck/unsized-rvalue-issue-41139.rs rust-lang#41139
- tests/ui/issues/issue-40749.rs -> tests/ui/wf/range-expr-root-of-constant-issue-40749.rs rust-lang#40749
- tests/ui/issues/issue-40235.rs -> tests/ui/while/while-let-scope-issue-40235.rs rust-lang#40235
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 6, 2025
Rollup merge of rust-lang#136536 - DuskyElf:master, r=jieyouxu

Rename and Move some UI tests to more suitable subdirs

## Affected Tests
- tests/ui/issues/issue-48838.rs -> tests/ui/enum/closure-in-enum-issue-48838.rs rust-lang#48838
- tests/ui/issues/issue-40350.rs -> tests/ui/enum/enum-inside-enum-issue-40350.rs rust-lang#40350
- tests/ui/issues/issue-41272.rs -> tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs rust-lang#41272
- tests/ui/issues/issue-40408.rs -> tests/ui/lexer/floating-point-0e10-issue-40408.rs rust-lang#40408
- tests/ui/issues/issue-40136.rs -> tests/ui/macros/const-expr-invocations-issue-40136.rs rust-lang#40136
- tests/ui/issues/issue-40845.rs -> tests/ui/macros/macros-in-trait-positions-issue-40845.rs rust-lang#40845
- tests/ui/issues/issue-41213.rs -> tests/ui/match/enum-and-break-in-match-issue-41213.rs rust-lang#41213
- tests/ui/issues/issue-40782.rs -> tests/ui/suggestions/for-loop-missing-in.rs rust-lang#40782
- tests/ui/issues/issue-40827.rs -> tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs rust-lang#40827
- tests/ui/issues/issue-40610.rs -> tests/ui/typeck/coercion-check-for-addition-issue-40610.rs rust-lang#40610
- tests/ui/issues/issue-40883.rs -> tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs rust-lang#40883
- tests/ui/issues/issue-40861.rs -> tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs rust-lang#40861
- tests/ui/issues/issue-41139.rs -> tests/ui/typeck/unsized-rvalue-issue-41139.rs rust-lang#41139
- tests/ui/issues/issue-40749.rs -> tests/ui/wf/range-expr-root-of-constant-issue-40749.rs rust-lang#40749
- tests/ui/issues/issue-40235.rs -> tests/ui/while/while-let-scope-issue-40235.rs rust-lang#40235
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-codegen Area: Code generation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. 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

No branches or pull requests

4 participants