Skip to content

error: internal compiler error: translating unsupported cast: *mut f32 (cast_pointer) -> f32 (cast_float) #15445

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

Closed
GuillaumeGomez opened this issue Jul 5, 2014 · 6 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@GuillaumeGomez
Copy link
Member

Hey, here's the error message given by rustc :

error: internal compiler error: translating unsupported cast: *mut f32 (cast_pointer) -> f32 (cast_float)
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:163

So here are my computer info :

  • mint 17 Cinnamon (2.2.13)
  • Linux kernel 3.13.0-24-generic
  • hardware architecture: x86_64

rustc -v gives me :
rustc 0.11.0-pre-nightly (5d5c20647f45f2eb74f337e5434bbe63b0c43345 2014-07-03 21:46:47 +0000)

If you need any more information, please ask.

Good continuation !

@GuillaumeGomez
Copy link
Member Author

Here is the backtrace :

stack backtrace:
   1:     0x2ba6720b5f50 - rt::backtrace::imp::write::h0a6e09d5ac6a396dQMp::v0.11.0
   2:     0x2ba6720bb890 - failure::on_fail::hb59ace9e326a1a4457p::v0.11.0
   3:     0x2ba671947cc0 - unwind::begin_unwind_inner::hf3d3b2017fc07a23cZd::v0.11.0
   4:     0x2ba673603e90 - unwind::begin_unwind::h5897199229657993564::v0.11.0
   5:     0x2ba673604830 - diagnostic::Handler::bug::h7e6dbd99aeae433dDgc::v0.11.0
   6:     0x2ba66ef57350 - driver::session::Session::bug::h3265e34a151b5575Xlr::v0.11.0
   7:     0x2ba66efd8d90 - middle::trans::expr::trans_imm_cast::he03de5a08ee3e7b1KQh::v0.11.0
   8:     0x2ba66efca840 - middle::trans::expr::trans_unadjusted::hd9a3a8c0c81f5db550f::v0.11.0
   9:     0x2ba66ef894c0 - middle::trans::expr::trans::hc2116d27852bd6d2DHf::v0.11.0
  10:     0x2ba66efc48e0 - middle::trans::callee::trans_args::hd2a2511dfbe94b6abef::v0.11.0
  11:     0x2ba66efbbb20 - middle::trans::callee::trans_call_inner::hdfdb8c30fa124095R1e::v0.11.0
  12:     0x2ba66efc1900 - middle::trans::callee::trans_call::h9df70b3aef437bdcZVe::v0.11.0
  13:     0x2ba66efcb640 - middle::trans::expr::trans_rvalue_dps_unadjusted::hf749359ec6e2a160hvg::v0.11.0
  14:     0x2ba66ef874e0 - middle::trans::expr::trans_into::hf0a37465b961389bIDf::v0.11.0
  15:     0x2ba66f078a50 - middle::trans::_match::trans_match_inner::h21253cb4fd5b92c9uOt::v0.11.0
  16:     0x2ba66efcb640 - middle::trans::expr::trans_rvalue_dps_unadjusted::hf749359ec6e2a160hvg::v0.11.0
  17:     0x2ba66ef874e0 - middle::trans::expr::trans_into::hf0a37465b961389bIDf::v0.11.0
  18:     0x2ba66ef87b10 - middle::trans::controlflow::trans_block::hecc22008fef2a1bd2ic::v0.11.0
  19:     0x2ba66efcb640 - middle::trans::expr::trans_rvalue_dps_unadjusted::hf749359ec6e2a160hvg::v0.11.0
  20:     0x2ba66ef874e0 - middle::trans::expr::trans_into::hf0a37465b961389bIDf::v0.11.0
  21:     0x2ba66ef87b10 - middle::trans::controlflow::trans_block::hecc22008fef2a1bd2ic::v0.11.0
  22:     0x2ba66f04a710 - middle::trans::base::trans_closure::h639d28c7bc97ae139tq::v0.11.0
  23:     0x2ba66ef58530 - middle::trans::base::trans_fn::he5cf57c39474f14caCq::v0.11.0
  24:     0x2ba66f04e620 - middle::trans::foreign::trans_rust_fn_with_foreign_abi::hb01b3dc1f75a84bamvy::v0.11.0
  25:     0x2ba66ef514a0 - middle::trans::base::trans_item::h17204c67e6746031BSq::v0.11.0
  26:     0x2ba66ef514a0 - middle::trans::base::trans_item::h17204c67e6746031BSq::v0.11.0
  27:     0x2ba66f05b300 - middle::trans::base::trans_crate::hfddcc2510b7c9311IMr::v0.11.0
  28:     0x2ba66f77fe80 - driver::driver::phase_4_translate_to_llvm::h6b5f55c3e1863d4cTuq::v0.11.0
  29:     0x2ba66f7773f0 - driver::driver::compile_input::hc5634315c7a145c8n8p::v0.11.0
  30:     0x2ba66f82af60 - driver::run_compiler::hae575e8dc5c8f87dVTs::v0.11.0
  31:     0x2ba66f82ae70 - driver::main_args::closure.117607
  32:     0x2ba66f83f010 - task::TaskBuilder<S>::try_future::closure.118749
  33:     0x2ba66f83ed00 - task::TaskBuilder<S>::spawn_internal::closure.118726
  34:     0x2ba66e9c0f40 - task::spawn_opts::closure.7519
  35:     0x2ba6719a01b0 - rust_try
  36:     0x2ba671944290 - unwind::try::hd5f4c2617b203e57BNd::v0.11.0
  37:     0x2ba671943fd0 - task::Task::run::headae25e22673ff0XYc::v0.11.0
  38:     0x2ba66e9c0d00 - task::spawn_opts::closure.7465
  39:     0x2ba671946af0 - thread::thread_start::hf8076cce1f95d94cvld::v0.11.0
  40:     0x2ba67271f0c0 - start_thread
  41:     0x2ba671d432d9 - __clone
  42:                0x0 - <unknown>

make: *** [rfmod] Error 101

@jdm
Copy link
Contributor

jdm commented Jul 7, 2014

What code were you building?

@GuillaumeGomez
Copy link
Member Author

Well, I'm not sure about sure about the one in fault so here are the two :

extern "C" fn read_callback(dsp_state: *mut ffi::FMOD_DSP_STATE, in_buffer: *mut c_float, out_buffer: *mut c_float, length: c_uint, in_channels: c_int, out_channels: c_int) -> fmod::Result {
     unsafe {
         let mut v_in_buffer = Vec::from_slice(std::c_vec::CVec::new(in_buffer, length as uint * in_channels as uint + out_channels as uint).as_slice());
        ...
}

let mut ptr = Vec::from_elem(spectrum_size, 0f32);
ffi::FMOD_System_GetSpectrum(self.system, ptr.as_mut_ptr(), spectrum_size as c_int, channel_offset, window_type)

For the second one, the first argument is a c_float* which is filled inside the function. The code built before so that's kind of weird.

@huonw huonw added the I-ICE label Jul 7, 2014
@jdm
Copy link
Contributor

jdm commented Jul 7, 2014

I would be surprised if those are at fault; the error should be coming from an explicit as expression that is casting from *mut f32 to f32.

@GuillaumeGomez
Copy link
Member Author

Yes, you're totally right. Error from this code :

extern "C" fn get_parameter_callback(dsp_state: *mut ffi::FMOD_DSP_STATE, index: c_int, value: *mut c_float, value_str: *mut c_char) -> fmod::Result {
...
value as f32
...
}

I didn't pay attention to value type... Big mistake ! Anyway, the error is reported, thanks !

@jdm
Copy link
Contributor

jdm commented Jul 7, 2014

Yeah, this is still something that should not be an ICE :) We should definitely be catching this during the typechecking phase inside check_cast in typeck/check/mod.rs.

bors added a commit that referenced this issue Jul 10, 2014
I've added an error message for casts from raw pointers to floats #15445.
@bors bors closed this as completed in 9bc7b6f Jul 10, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 21, 2023
fix: Fix `only_types` config filtering out traits from world symbols

It is a bit confusing that this apparently did not filter every trait out though...

Closes rust-lang/rust-analyzer#15444
Closes rust-lang/rust-analyzer#15200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants