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

call and match bypasses bounds check #79

Open
andrewchambers opened this issue Feb 9, 2016 · 1 comment
Open

call and match bypasses bounds check #79

andrewchambers opened this issue Feb 9, 2016 · 1 comment

Comments

@andrewchambers
Copy link
Contributor

use std

const main = {
    var name
    var path = "/xxx"[:]

    match std.strfind(path, "/")
    | `std.Some i:
        name = path[0:i-1]
    | `std.None:
    ;;
    std.put("FAIL\n")
}
ac@black:~/Desktop/bug$ mbld -R bug.myr 
/tmp/runmyr1962868523...
    6m  bug.myr 
    ld  -o /tmp/runmyr1962868523 /usr/local/lib/myr/_myrrt.o bug.o -L/usr/local/lib/myr -lstd -lsys 
    /tmp/runmyr1962868523   
FAIL
@andrewchambers andrewchambers changed the title Construct bypasses bounds check call and match bypasses bounds check Feb 9, 2016
@oridb
Copy link
Owner

oridb commented Feb 9, 2016

This issue, I think, comes in 2 parts:

  1. We are doing a signed check on the bounds, so upper, in this case, is less than lower.
  2. We aren't checking that upper > lower.

We should probably do this, although I cringe a bit on the efficiency front. I guess if/when we get VRP going, this will become much less painful.

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