Stream: git-wasmtime

Topic: wasmtime / PR #13837 Use _Alignof instead of __alignof in...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 08:54):

crowforkotlin opened PR #13837 from crowforkotlin:fix-i686-alignment to bytecodealliance:main:

Closes #13733

The static_assert checks in val.h used __alignof (GCC extension)
which returns preferred alignment rather than ABI alignment. On i686
these differ for uint64_t (8 vs 4), causing a compile
failure. Switch to _Alignof (C11) which matches the value the
compiler uses for struct layout.
samples: https://github.com/crowforkotlin/wasmtime_c_api_32bit_issues
issues & effect : #13733
references: https://en.cppreference.com/c/language/_Alignof

> bash qemu-i686-test.sh
Compile OK. Running...
=== i686 (SysV ABI) layout probe ===

__alignof(uint64_t) = 8
_Alignof(uint64_t)  = 4
__alignof(int64_t)  = 8
_Alignof(int64_t)   = 4
__alignof(double)   = 8
_Alignof(double)    = 4

sizeof(wasmtime_val_t)    = 20
_Alignof(wasmtime_val_t)  = 4
__alignof(wasmtime_val_t) = 4
offsetof(kind)            = 0
offsetof(of)              = 4

sizeof(wasmtime_valunion_t)    = 16
_Alignof(wasmtime_valunion_t)  = 4
__alignof(wasmtime_valunion_t) = 4

sizeof(wasmtime_val_raw_t)  = 16
_Alignof(wasmtime_val_raw_t)= 4

=== static_assert passed ===

> export WASMTIME_DIR=~/develop/github/wasmtime/
> export NDK=/home/crowf/Android/Sdk/ndk/28.2.13676358
> bash qemu-armv7a-test.sh
Compile OK. Running (needs sudo for unshare)...
=== armv7a (AAPCS32) layout probe ===

__alignof(uint64_t) = 8
_Alignof(uint64_t)  = 8
__alignof(int64_t)  = 8
_Alignof(int64_t)   = 8
__alignof(double)   = 8
_Alignof(double)    = 8

sizeof(wasmtime_val_t)    = 24
_Alignof(wasmtime_val_t)  = 8
__alignof(wasmtime_val_t) = 8
offsetof(kind)            = 0
offsetof(of)              = 8

sizeof(wasmtime_valunion_t)    = 16
_Alignof(wasmtime_valunion_t)  = 8
__alignof(wasmtime_valunion_t) = 8

sizeof(wasmtime_val_raw_t)  = 16
_Alignof(wasmtime_val_raw_t)= 8

=== static_assert passed ===

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 08:54):

crowforkotlin requested fitzgen for a review on PR #13837.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 08:54):

crowforkotlin requested wasmtime-core-reviewers for a review on PR #13837.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 08:57):

crowforkotlin edited PR #13837:

Closes #13733

The static_assert checks in val.h used __alignof (GCC extension) which returns preferred alignment rather than ABI alignment. On i686 these differ for uint64_t (8 vs 4), causing a compile failure. Switch to _Alignof (C11) which matches the value the compiler uses for struct layout.

samples: https://github.com/crowforkotlin/wasmtime_c_api_32bit_issues
issues & effect : #13733
references: https://en.cppreference.com/c/language/_Alignof

> bash qemu-i686-test.sh
Compile OK. Running...
=== i686 (SysV ABI) layout probe ===

__alignof(uint64_t) = 8
_Alignof(uint64_t)  = 4
__alignof(int64_t)  = 8
_Alignof(int64_t)   = 4
__alignof(double)   = 8
_Alignof(double)    = 4

sizeof(wasmtime_val_t)    = 20
_Alignof(wasmtime_val_t)  = 4
__alignof(wasmtime_val_t) = 4
offsetof(kind)            = 0
offsetof(of)              = 4

sizeof(wasmtime_valunion_t)    = 16
_Alignof(wasmtime_valunion_t)  = 4
__alignof(wasmtime_valunion_t) = 4

sizeof(wasmtime_val_raw_t)  = 16
_Alignof(wasmtime_val_raw_t)= 4

=== static_assert passed ===

> export WASMTIME_DIR=~/develop/github/wasmtime/
> export NDK=/home/crowf/Android/Sdk/ndk/28.2.13676358
> bash qemu-armv7a-test.sh
Compile OK. Running (needs sudo for unshare)...
=== armv7a (AAPCS32) layout probe ===

__alignof(uint64_t) = 8
_Alignof(uint64_t)  = 8
__alignof(int64_t)  = 8
_Alignof(int64_t)   = 8
__alignof(double)   = 8
_Alignof(double)    = 8

sizeof(wasmtime_val_t)    = 24
_Alignof(wasmtime_val_t)  = 8
__alignof(wasmtime_val_t) = 8
offsetof(kind)            = 0
offsetof(of)              = 8

sizeof(wasmtime_valunion_t)    = 16
_Alignof(wasmtime_valunion_t)  = 8
__alignof(wasmtime_valunion_t) = 8

sizeof(wasmtime_val_raw_t)  = 16
_Alignof(wasmtime_val_raw_t)= 8

=== static_assert passed ===

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2026 at 09:06):

crowforkotlin updated PR #13837.


Last updated: Jul 29 2026 at 05:03 UTC