Skip to content

ICE: LLVM Assertion failed: Invalid operand types for ICmp instruction #17206

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
rndr opened this issue Sep 12, 2014 · 2 comments
Closed

ICE: LLVM Assertion failed: Invalid operand types for ICmp instruction #17206

rndr opened this issue Sep 12, 2014 · 2 comments

Comments

@rndr
Copy link

rndr commented Sep 12, 2014

Os is Ubuntu 14.04.1 LTS on amd64

uname -a is Linux ubuntu 3.13.0-34-generic #60-Ubuntu SMP Wed Aug 13 15:45:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

rustc -v is rustc 0.12.0-pre-nightly (e024017f6 2014-09-04 20:21:02 +0000)

Code (as minimal as i could get it to not work):

use std::io::BufReader;

mod test {
    use std::io::{Reader,IoError};
    use std::collections::HashMap;

    pub type TEST<'t> = HashMap<u16, Option<Box<DataFormat>>>;

    enum DataFormat {
        Something(str),
        Undefined
    }

    enum ByteOrder {
        BigEndian,
        LittleEndian
    }

    impl<T: Reader> DataFormat {
        fn read(&mut self, stream: &mut T, order: ByteOrder) -> Result<Box<DataFormat>, IoError> {
            let (tag, format) = match order {
                BigEndian =>
                    (try!(stream.read_be_u16()), try!(stream.read_be_u16())),
                LittleEndian =>
                    (try!(stream.read_le_u16()), try!(stream.read_le_u16())),
            };
            Ok(box Undefined)
        }
    }

    pub fn parse<T: Reader>(stream: &mut T) -> Result<(), IoError> {
        let mut test: TEST = HashMap::new();
        Ok(())
    }
}

fn main() {
    let mut buf = [0, 1, 2, 3];
    let mut r = BufReader::new(buf);
    test::parse(&mut r);
    return;
}

Output (with warnings skipped):

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/llvm/include/llvm/IR/Instructions.h:987: void llvm::ICmpInst::AssertOK(): Assertion `(getOperand(0)->getType()->isIntOrIntVectorTy() || getOperand(0)->getType()->isPtrOrPtrVectorTy()) && "Invalid operand types for ICmp instruction"' failed.
Aborted (core dumped)
@rndr rndr changed the title Assertion failed: Invalid operand types for ICmp instruction ICE: LLVM Assertion failed: Invalid operand types for ICmp instruction Sep 13, 2014
@bkoropoff
Copy link
Contributor

I can't repro this on latest master. Instead I get a compiler error:

test.rs:27:20: 27:29 error: cannot move a value of type test::DataFormat: the size of test::DataFormat cannot be statically determined [E0161]
test.rs:27             Ok(box Undefined)
                              ^~~~~~~~~
error: aborting due to previous error

You probably meant for DataFormat to be:

    enum DataFormat {
        Something(String),
        Undefined
    }

The code then successfully compiles. I suspect this was DST fallout that got fixed already.

@rndr
Copy link
Author

rndr commented Sep 15, 2014

Can confirm, fixed in latest nightly build for me.
rustc 0.12.0-pre-nightly (79a5448f4 2014-09-13 20:36:02 +0000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants