Skip to content

invoke outputs garbage #122

Closed
Closed

Description

@kg

When invoking functions with a void return type, ml-proto acts like they have a return type and outputs garbage (the last expression in the function body, seems like?)

(module 
  (import $write "stdio" "write" (param i32 i32))

  (memory 4096 4096 (segment 0 "\89\50\4e\47\0d\0a\1a\0a\00"))

  (func $write_png_header
    (call_import $write (i32.const 0) (i32.const 9))
    (i32.const 7)
  )

  (export "write_png_header" $write_png_header)
)

(invoke "write_png_header")

prints 7 : i32 at the end.

Activity

  1. lukewagner commented on Oct 9, 2015

    @lukewagner
    Member

    It's not "garbage", it's just not replacing the result of evaluating the body with None, as it ought.

  2. added a commit that references this issue on Feb 11, 2021
  3. added a commit that references this issue on Sep 4, 2024
  4. added a commit that references this issue on Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions