impala icon indicating copy to clipboard operation
impala copied to clipboard

Compilation problem on while true

Open StefanRRichter opened this issue 9 years ago • 1 comments

Hi,

the following code does not compile for me, except if i change the condition of the while loop to something that is not 'true'. I am using the master branch version.

Code:

fn circular_iteration(sizeLog2 : u64, mut idx : u64, body: fn(u64, fn())) -> () {
    let mask = (1u64 << sizeLog2) - 1u64;
    while true { // this true is triggering the problem
        body(idx);
        idx = (idx + 1u64) & mask;
    }
}

fn main() -> bool {
    for i in circular_iteration(8u64, 42u64) {
        if i == 23u64 {
            break()
        }
        thorin_print_long(i as i64);
        thorin_print_string("\n");
    }
    true
}

Error Message:

impala: /home/srichter/anydsl/anydsl/thorin/src/thorin/analyses/scope.cpp:210: void thorin::Scope::build_rev_rpo(thorin::Array<thorin::Lambda*>): Assertion `n == 0' failed.

StefanRRichter avatar Sep 09 '15 13:09 StefanRRichter

Hi,

thanks for reporting the bug. This is a known problem. We are working on that, but it will take some time :)

In the mean time, when you just want to get your code working, don't use trivial endless loops.

leissa avatar Sep 09 '15 14:09 leissa