Skip to content

Misuse of size_t vs uint64_t? #278

@juj

Description

@juj

The type size_t is not guaranteed to be 64-bit, but it looks like the code assumes in several places that it always is. We should replace size_t with uint64_t in all places where a strictly necessary 64-bit integer is required.

An example of where it looks like 64-bit integers are intended(?) is S2WasmBuilder in https://github.com/WebAssembly/binaryen/blob/master/src/s2wasm.h#L50, and the size_t members in https://github.com/WebAssembly/binaryen/blob/master/src/s2wasm.h#L90. These are explicitly parsed as unsigned long long from https://github.com/WebAssembly/binaryen/blob/master/src/s2wasm-main.cpp#L86, indicating that these should be 64-bit always? However e.g. when building on Visual Studio on Windows as a 32-bit executable, size_t is only 32-bit and truncation will occur.

In current executing form, in wasm runtime addresses are still 32-bit, but I presume the code intends to be forward compatible and operate on 64-bit integers for all addresses for the future when we might expand to a 64-bit address space?

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy