Bug 239698

Summary: [WASM] Fix warning: cast from ‘char*’ to ‘JSC::Wasm::Type*’ increases required alignment of target type [-Wcast-align]
Product: WebKit Reporter: Dmitry <dbezhetskov>
Component: WebAssemblyAssignee: Dmitry <dbezhetskov>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Dmitry
Reported 2022-04-23 22:14:17 PDT
[WASM] Fix warning: cast from ‘char*’ to ‘JSC::Wasm::Type*’ increases required alignment of target type [-Wcast-align]
Attachments
Patch (4.29 KB, patch)
2022-04-23 22:15 PDT, Dmitry
no flags
Patch (4.77 KB, patch)
2022-04-25 06:45 PDT, Dmitry
no flags
Patch (4.74 KB, patch)
2022-04-25 22:00 PDT, Dmitry
no flags
Dmitry
Comment 1 2022-04-23 22:15:56 PDT
Yusuke Suzuki
Comment 2 2022-04-24 23:16:46 PDT
Comment on attachment 458227 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458227&action=review Commented. > Source/JavaScriptCore/wasm/WasmTypeDefinition.h:83 > + void* const m_payload; I wonder if we should just change it to `Type*`. > Source/JavaScriptCore/wasm/WasmTypeDefinition.h:121 > + void* const m_payload; How about changing it to `StructField*`?
Dmitry
Comment 3 2022-04-25 06:45:30 PDT
Darin Adler
Comment 4 2022-04-25 09:41:17 PDT
Comment on attachment 458266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458266&action=review > Source/JavaScriptCore/wasm/WasmTypeDefinition.h:132 > + : m_typeHeader { FunctionSignature { reinterpret_cast<Type*>(payload()), argCount, retCount } } Casting from void* can and should be done with static_cast instead of reinterpret_cast. > Source/JavaScriptCore/wasm/WasmTypeDefinition.h:137 > + : m_typeHeader { StructType { reinterpret_cast<StructField*>(payload()), fieldCount } } Ditto. > Source/JavaScriptCore/wasm/WasmTypeDefinition.h:142 > + void* payload() { return reinterpret_cast<void*>(this + 1); } This should not need a type cast. TypeDefinition* can be converted to void* without one
Dmitry
Comment 5 2022-04-25 22:00:41 PDT
EWS
Comment 6 2022-04-26 19:01:16 PDT
Committed r293492 (250025@main): <https://commits.webkit.org/250025@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458328 [details].
Radar WebKit Bug Importer
Comment 7 2022-04-26 19:02:15 PDT
Note You need to log in before you can comment on or make changes to this bug.