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

Another to_cfg crash #188

Open
oflatt opened this issue Nov 16, 2023 · 3 comments
Open

Another to_cfg crash #188

oflatt opened this issue Nov 16, 2023 · 3 comments
Assignees

Comments

@oflatt
Copy link
Member

oflatt commented Nov 16, 2023

@main() {
    i: int = const 1;
    jmp .loop;
.loop:
    max: int = const 10;
    cond: bool = lt i max;
    br cond .t .f;
.t:
    res: int = const 7;
    jmp .loopbottom;
.f:
    res: int = const 8;
    jmp .loopbottom;
.loopbottom:
    one: int = const 1;
    i: int = add i one;
    br cond .loop .exit;
.exit:
    print res;
}
@oflatt oflatt self-assigned this Nov 16, 2023
@oflatt oflatt moved this to Todo in Bril Milestone Board Nov 16, 2023
@oflatt oflatt moved this from Todo to In Progress in Bril Milestone Board Nov 16, 2023
@oflatt
Copy link
Member Author

oflatt commented Nov 16, 2023

Looks like the original RVSDG generated from the bril program is referring to a non-existant argument

test2

@ezrosent
Copy link
Collaborator

This one is interesting: Basically, what's happening is that res is not defined at the start of the loop, but because it's always assigned inside the loop and the loop itself runs at least once, it's safe to use it as an output.

Lots of ways to handle this: "undef" variables? Adding special output-only ports to thetas?

@oflatt
Copy link
Member Author

oflatt commented Nov 17, 2023

That is interesting!
Alternative proposal: Can we disallow these programs? I'd like to throw an error for undef variables

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