Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Can I save an exception to a local variable? #77

@Horcrux7

Description

@Horcrux7

Exist an exception value of type except_ref only on the stack or can I safe it also in a local variable? Which type should the local variable have?

I try the follow code with wabt:

(module
  (func $foo (result i32) (local $ex anyref)
    try
      i32.const 5
      i32.const 0
      i32.div_s
      return
    catch
      local.set 0
      i32.const 2
      return
    end
  )
)

and receive:
error: type mismatch in local.set, expected [anyref] but got [except_ref]

The using of a local type except_ref work also not.

If there would be some test code then it can be very helpful.

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