Skip to content

Referenced variable location is not an alloca! #20384

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
coder543 opened this issue Jan 1, 2015 · 1 comment
Closed

Referenced variable location is not an alloca! #20384

coder543 opened this issue Jan 1, 2015 · 1 comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@coder543
Copy link

coder543 commented Jan 1, 2015

This is the first time I've actually spent much time playing around with rust, so I probably just wrote some code that was very unexpected for the compiler. Here's the backtrace:

src/eg05.rs:53:13: 53:19 error: internal compiler error: debuginfo::create_local_var_metadata() - Referenced variable location is not an alloca!
src/eg05.rs:53         let s_rect = Some(surface.get_rect());
                           ^~~~~~
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:     0x7f91ec606110 - sys::backtrace::write::h4bab949887dac0c7zat
   2:     0x7f91ec625f10 - failure::on_fail::h441e5a1820cd6786srz
   3:     0x7f91ec59be70 - rt::unwind::begin_unwind_inner::h486e1ba2aedf0a36w5y
   4:     0x7f91e7698ca0 - rt::unwind::begin_unwind::h10348708083188279757
   5:     0x7f91e7698c30 - diagnostic::SpanHandler::span_bug::h76fa8d3c461a05c4bJF
   6:     0x7f91ea56ba00 - session::Session::span_bug::hfc0762eee9d950b53jn
   7:     0x7f91eb49a3d0 - middle::pat_util::pat_bindings::closure.48467
   8:     0x7f91e7661f50 - ast_util::walk_pat::hd8c3c64961fdf7a2TkC
   9:     0x7f91eb387620 - trans::controlflow::trans_block::h12d1b1c29fe0d7cbcYd
  10:     0x7f91eb3cc5b0 - trans::expr::trans_rvalue_stmt_unadjusted::hd28699d545991297KUi
  11:     0x7f91eb386ec0 - trans::expr::trans_into::h3c3710e6ca2ca88dLzh
  12:     0x7f91eb3862a0 - trans::controlflow::trans_stmt_semi::h2c62833a881b1b43jXd
  13:     0x7f91eb387620 - trans::controlflow::trans_block::h12d1b1c29fe0d7cbcYd
  14:     0x7f91eb4441a0 - trans::base::trans_closure::h99f933ea6f1e01c5BYt
  15:     0x7f91eb37bd90 - trans::base::trans_fn::hf71ee8d58ecc6d28q9t
  16:     0x7f91eb3770e0 - trans::base::trans_item::hc39398da93f34132Swu
  17:     0x7f91eb44bf10 - trans::base::trans_crate::hbaaa84f58ddebf49vsv
  18:     0x7f91ecb572d0 - driver::phase_4_translate_to_llvm::h491e2dead8eb9d7fcFa
  19:     0x7f91ecb371e0 - driver::compile_input::hc83f8f50017addacvba
  20:     0x7f91ecc7dbb0 - thunk::F.Invoke<A,$u{20}R$GT$::invoke::h10576259651718141556
  21:     0x7f91ecc7c970 - rt::unwind::try::try_fn::h9568114966234907229
  22:     0x7f91ec68b440 - rust_try_inner
  23:     0x7f91ec68b430 - rust_try
  24:     0x7f91ecc7ccc0 - thunk::F.Invoke<A,$u{20}R$GT$::invoke::h7353494892923989973
  25:     0x7f91ec615890 - sys::thread::thread_start::hd8a164ae33ed6e55u3v
  26:     0x7f91e6eb3fe0 - start_thread
  27:     0x7f91ec243819 - __clone
  28:                0x0 - <unknown>

Could not compile `sdl2-examples`.

I was playing with these examples, specifically I was modifying example 5. Here is the (very broken, probably terrible code, sorry) diff of eg05.rs that shows the state the file was in when Rust broke.

diff --git a/src/eg05.rs b/src/eg05.rs
index 39c26fd..88632fa 100644
--- a/src/eg05.rs
+++ b/src/eg05.rs
@@ -3,6 +3,8 @@ extern crate sdl2;
 use sdl2::video::{WindowPos, Window, OPENGL};
 use sdl2::event::{Event, poll_event};
 use sdl2::surface::{Surface};
+use sdl2::rect::Rect;
+use std::io::timer::sleep;

 fn main() {
     sdl2::init(sdl2::INIT_EVERYTHING);
@@ -31,12 +33,14 @@ fn main() {
     };

     let _ = renderer.clear();
-    // Display the texture.
-    // Omitting the src & dst Rect arguments will cause our image to stretch across the entire buffer.
-    // Try passing Some(surface.get_rect()) for src & dst instead of None & see how things change.
-    let _ = renderer.copy(&texture, None, None);
+    let s_rect = Some(surface.get_rect());
+    let z_rect = Some(Rect::new(120,80,128,114));
+    println!("s_rect: {}", s_rect);
+    let _ = renderer.copy(&texture, s_rect, z_rect);
     let _ = renderer.present();

+    let mut x = 120;
+

     // loop until we receive a QuitEvent
     'event : loop {
@@ -44,6 +48,14 @@ fn main() {
             Event::Quit(_) => break 'event,
             _            => continue
         }
+        sleep(std::time::duration::Duration::milliseconds(200));
+        let _ = renderer.clear();
+        let s_rect = Some(surface.get_rect());
+        let z_rect = Some(Rect::new(x,80,128,114));
+        println!("s_rect: {}", s_rect);
+        let _ = renderer.copy(&texture, s_rect, z_rect);
+        let _ = renderer.present();
+        x += 30;
     }

     sdl2::quit();

And here is the requested version info for rust:

rustc 0.13.0-nightly (fea5aa656 2014-12-30 00:42:13 +0000)
binary: rustc
commit-hash: fea5aa656ff4349f4d3e1fea1447d26986762ae1
commit-date: 2014-12-30 00:42:13 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly

I'm using rust on a 64-bit Acer C720P Chromebook, with Ubuntu 14.10 running in a chroot.

@jdm jdm added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Jan 1, 2015
@jdm
Copy link
Contributor

jdm commented Jan 1, 2015

This is a duplicate of #20312 since the additions inside the 'event loop are unreachable.

@jdm jdm closed this as completed Jan 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants