Skip to content

internal compiler error: incorrect size with sdl::video::PixelFormat #13714

Closed
@robn

Description

@robn

Possible (probable) duplicate of #13186.

Compiling the following program against with rust@30fe550 against brson/rust-sdl@804adf6:

extern crate sdl;

static my_pixfmt: sdl::video::PixelFormat = sdl::video::PixelFormat {
    palette: None,
    bpp: 24,
    r_loss: 0,
    g_loss: 0,
    b_loss: 0,
    a_loss: 0,
    r_shift: 16,
    g_shift: 8,
    b_shift: 0,
    a_shift: 0,
    r_mask: 0xff,
    g_mask: 0xff00,
    b_mask: 0xff0000,
    a_mask: 0,
    color_key: 0,
    alpha: 0,
};

fn main() {
    print!("{:?}", my_pixfmt);
}

gives:

$ RUST_BACKTRACE=1 rustc -L rust-sdl -o test test.rs
{ { i8, [15 x i8] }, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i8 } { { i8, [15 x i8] } { i8 0, [15 x i8] undef }, i8 24, i8 0, i8 0, i8 0, i8 0, i8 16, i8 8, i8 0, i8 0, i32 255, i32 65280, i32 16711680, i32 0, i32 0, i8 0 }
{ { i8, [7 x i8], [1 x i64] }, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i8 } undef
error: internal compiler error: const expr(8: sdl::video::PixelFormat{palette: None,
                        bpp: 24,
                        r_loss: 0,
                        g_loss: 0,
                        b_loss: 0,
                        a_loss: 0,
                        r_shift: 16,
                        g_shift: 8,
                        b_shift: 0,
                        a_shift: 0,
                        r_mask: 255,
                        g_mask: 65280,
                        b_mask: 16711680,
                        a_mask: 0,
                        color_key: 0,
                        alpha: 0,}) of type sdl::video::PixelFormat has size 52 instead of 56
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /home/robn/code/rust/rust/src/libsyntax/diagnostic.rs:155
stack backtrace:
   1:     0x7f46a1812930 - rt::backtrace::imp::write::h726c0ee05b0a1251rta::v0.11.pre
   2:     0x7f46a1772370 - rt::unwind::begin_unwind_inner::h9b7e455dab1796daw39::v0.11.pre
   3:     0x7f46a0c39430 - rt::unwind::begin_unwind::h5910056841063238677::v0.11.pre
   4:     0x7f46a0c3a490 - diagnostic::Handler::bug::h0f9bbab1cbb7e822AYb::v0.11.pre
   5:     0x7f46a2429510 - driver::session::Session::bug::h6e55d6e6cbf0d844bhh::v0.11.pre
   6:     0x7f46a24db640 - middle::trans::consts::const_expr::ha281951f96861546GFj::v0.11.pre
   7:     0x7f46a2426850 - middle::trans::base::get_item_val::h4b8a8b57d5346ddbBNp::v0.11.pre
   8:     0x7f46a24dd3c0 - middle::trans::consts::trans_const::h6abb7670a66f1aecstk::v0.11.pre
   9:     0x7f46a2425440 - middle::trans::base::trans_item::h65d6980b59f31439Btp::v0.11.pre
  10:     0x7f46a250d2c0 - middle::trans::base::trans_mod::hdd24677d9163c30cHyp::v0.11.pre
  11:     0x7f46a25151a0 - middle::trans::base::trans_crate::h0920ca7f9115adc25dq::v0.11.pre
  12:     0x7f46a2c404a0 - driver::driver::phase_4_translate_to_llvm::hb81995af2fcfe7361Cf::v0.11.pre
  13:     0x7f46a2c42a90 - driver::driver::compile_input::hfaa2edba3ed249a4QSf::v0.11.pre
  14:     0x7f46a2c67490 - run_compiler::h0c58ff7ffab7f82efpn::v0.11.pre
  15:     0x7f46a2c7f210 - main_args::closure.91455
  16:     0x7f46a2c7d710 - monitor::closure.91330
  17:     0x7f46a2c79000 - task::TaskBuilder::try::closure.91096
  18:     0x7f46a1e9d650 - task::spawn_opts::closure.7103
  19:     0x7f46a180d970 - rt::task::Task::run::closure.39989
  20:     0x7f46a18196b0 - rust_try
  21:     0x7f46a180d7b0 - rt::task::Task::run::hc79a6e8202de0a541T7::v0.11.pre
  22:     0x7f46a1e9d420 - task::spawn_opts::closure.7076
  23:     0x7f46a1811470 - rt::thread::thread_start::h915d8ac90bd84ba1My8::v0.11.pre
  24:     0x7f469f52ffa0 - start_thread
  25:     0x7f46a1445a09 - __clone
  26:                0x0 - <unknown>

Unfortunately I was unable to reduce this to a case that doesn't require rust-sdl. The PixelFormat structure is a bit too complex for me to know which bits are important for this case.

Happy to help reduce it further if I can. Let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions