Skip to content

load_global after store_global doesn't return the value? #56

Closed

Description

@marianoguerra

hi, the following code returns 0 for the 3 expressions in comments at the bottom.

shouldn't the last one return 32?

(module
   (global $rx0 i32)

   (func $gx0 (load_global $rx0))
   (func $sx0 (param i32) (store_global $rx0 (get_local 0)))

   (export "gx0" $gx0)
   (export "sx0" $gx0)

   (;
    (invoke "gx0") ;; returns 0
    (invoke "sx0" (i32.const 32)) ;; returns 0
    (invoke "gx0") ;; returns 0, should return 32?
   ;)
)

Activity

  1. marianoguerra commented on Sep 11, 2015

    @marianoguerra
    Author

    doing the operations inside the module seems to work:

    (module
       (global $rx0 i32)
    
       (func $gx0 (load_global $rx0))
       (func $sx0 (param i32) (store_global $rx0 (get_local 0)))
    
       (func $storeandload
        (call $sx0 (i32.const 42))
        (call $gx0))
    
    
       (export "gx0" $gx0)
       (export "sx0" $gx0)
       (export "storeandload" $storeandload)
    
       (;
        (invoke "gx0") ;; returns 0
        (invoke "sx0" (i32.const 32)) ;; returns 0
        (invoke "gx0") ;; returns 0, should return 32?
        (invoke "storeandload") ;; this one returns 42 as expected
       ;)
    )
    
  2. lukewagner commented on Sep 11, 2015

    @lukewagner
    Member

    Looks like a "bug" in the testcase :)

       (export "sx0" $gx0)
    

    should be

       (export "sx0" $sx0)
    

    Closing, but feel to reopen if I've misdiagnosed.

  3. added a commit that references this issue on Mar 17, 2023
  4. added a commit that references this issue on Aug 30, 2024
  5. added a commit that references this issue on Jan 20, 2025
  6. added a commit that references this issue on Sep 26, 2026
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