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

WAT: "RuntimeError: index out of bounds" for simple code #118

Open
certik opened this issue Dec 4, 2023 · 0 comments
Open

WAT: "RuntimeError: index out of bounds" for simple code #118

certik opened this issue Dec 4, 2023 · 0 comments

Comments

@certik
Copy link
Contributor

certik commented Dec 4, 2023

The following code:

print *, "OK 5"
end

compiles and runs correctly, but on the WAT tab it says:

RuntimeError: index out of bounds
ERROR: WAT could not be generated from the code

Although locally it works:

$ lfortran a.f90 --show-wat
(module
    (type (;0;) (func (param i32) (result)))
    (type (;1;) (func (param i32 i32 i32 i32) (result i32)))
    (type (;2;) (func (param) (result)))
    (import "wasi_snapshot_preview1" "proc_exit" (func (;0;) (type 0)))
    (import "wasi_snapshot_preview1" "fd_write" (func (;1;) (type 1)))
    (global $0 (mut i32) (i32.const 0))
    (global $1 (mut i32) (i32.const 0))
    (global $2 (mut i64) (i64.const 0))
    (global $3 (mut f32) (f32.const 0.000000))
    (global $4 (mut f32) (f32.const 0.000000))
    (global $5 (mut f64) (f64.const 0.000000))
    (global $6 (mut f64) (f64.const 0.000000))
    (func $2 (type 2) (param) (result)
        (local)
        i32.const 1
        i32.const 208
        i32.const 1
        i32.const 0
        call 1
        drop
        i32.const 1
        i32.const 16
        i32.const 1
        i32.const 0
        call 1
        drop
        i32.const 0
        call 0
        return
    )
    (memory (;0;) 1000 1000)
    (export "memory" (memory 0))
    (export "_start" (func 2))
    (data (;0;) (i32.const 4) "\0c\00\00\00\01\00\00\00")
    (data (;1;) (i32.const 12) "    ")
    (data (;2;) (i32.const 16) "\18\00\00\00\01\00\00\00")
    (data (;3;) (i32.const 24) "\n   ")
    (data (;4;) (i32.const 28) "\24\00\00\00\01\00\00\00")
    (data (;5;) (i32.const 36) "-   ")
    (data (;6;) (i32.const 40) "\30\00\00\00\01\00\00\00")
    (data (;7;) (i32.const 48) ".   ")
    (data (;8;) (i32.const 52) "\3c\00\00\00\01\00\00\00")
    (data (;9;) (i32.const 60) "(   ")
    (data (;10;) (i32.const 64) "\48\00\00\00\01\00\00\00")
    (data (;11;) (i32.const 72) ")   ")
    (data (;12;) (i32.const 76) "\54\00\00\00\01\00\00\00")
    (data (;13;) (i32.const 84) ",   ")
    (data (;14;) (i32.const 88) "\60\00\00\00\01\00\00\00")
    (data (;15;) (i32.const 96) "0   ")
    (data (;16;) (i32.const 100) "\6c\00\00\00\01\00\00\00")
    (data (;17;) (i32.const 108) "1   ")
    (data (;18;) (i32.const 112) "\78\00\00\00\01\00\00\00")
    (data (;19;) (i32.const 120) "2   ")
    (data (;20;) (i32.const 124) "\84\00\00\00\01\00\00\00")
    (data (;21;) (i32.const 132) "3   ")
    (data (;22;) (i32.const 136) "\90\00\00\00\01\00\00\00")
    (data (;23;) (i32.const 144) "4   ")
    (data (;24;) (i32.const 148) "\9c\00\00\00\01\00\00\00")
    (data (;25;) (i32.const 156) "5   ")
    (data (;26;) (i32.const 160) "\a8\00\00\00\01\00\00\00")
    (data (;27;) (i32.const 168) "6   ")
    (data (;28;) (i32.const 172) "\b4\00\00\00\01\00\00\00")
    (data (;29;) (i32.const 180) "7   ")
    (data (;30;) (i32.const 184) "\c0\00\00\00\01\00\00\00")
    (data (;31;) (i32.const 192) "8   ")
    (data (;32;) (i32.const 196) "\cc\00\00\00\01\00\00\00")
    (data (;33;) (i32.const 204) "9   ")
    (data (;34;) (i32.const 208) "\d8\00\00\00\04\00\00\00")
    (data (;35;) (i32.const 216) "OK 5")
)
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

1 participant