Skip to content
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

arbitrary bit-width integers leads to an LLVM error #2373

Closed
komuw opened this issue Apr 28, 2019 · 2 comments
Closed

arbitrary bit-width integers leads to an LLVM error #2373

komuw opened this issue Apr 28, 2019 · 2 comments

Comments

@komuw
Copy link

@komuw komuw commented Apr 28, 2019

The following program works okay:

const std = @import("std");
const warn = std.debug.warn;
const assert = @import("std").debug.assert;

pub fn main() void {
    const message = "aa";

    var sum: u128 = 0;
    for (message) |byte| {
        assert(byte == 97);
        sum += byte;
    }

    assert(sum == 97 + 97);
    warn("\n sum:: {} ", sum);
}
zig fmt . && zig build-exe cool.zig && ./cool

 sum:: 194

However, trying to use arbitrary bit-width integers leads to an LLVM error with no stack trace.

const std = @import("std");
const warn = std.debug.warn;
const assert = @import("std").debug.assert;

pub fn main() void {
    const message = "aa";

    var sum: u256 = 0;
    for (message) |byte| {
        assert(byte == 97);
        sum += byte;
    }

    assert(sum == 97 + 97);
    warn("\n sum:: {} ", sum);
}
zig fmt . && zig build-exe cool.zig && ./cool
   LLVM ERROR: Unsupported library call operation!

my system:
zig version: 0.4.0+205e501
uname -ra: Darwin Kernel Version 16.7.0: Sun Oct 28 22:30:19 PDT 2018; root:xnu-3789.73.27~1/RELEASE_X86_64 x86_64

@komuw
Copy link
Author

@komuw komuw commented Apr 28, 2019

just found;
#1485
and
#1534
which are probably related.

We can close this issue if someone can confirm whether this is a duplicate of the above two named issues

@andrewrk
Copy link
Member

@andrewrk andrewrk commented Apr 28, 2019

Yes - I would consider this a duplicate of #1485.

@andrewrk andrewrk closed this Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants