[msl] Polyfill signed integer arithmetic Avoid UB caused by signed integer overflow by bitcasting to unsigned integers and back again. Bug: 42251016 Change-Id: I98078a9a4e9603b3ab6faa4dbc0fc0812a5dcc3e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/205235 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: James Price <jrprice@google.com>
diff --git a/test/tint/array/assign_to_subexpr.wgsl.expected.ir.msl b/test/tint/array/assign_to_subexpr.wgsl.expected.ir.msl index 265bd44..c7b0190 100644 --- a/test/tint/array/assign_to_subexpr.wgsl.expected.ir.msl +++ b/test/tint/array/assign_to_subexpr.wgsl.expected.ir.msl
@@ -34,7 +34,7 @@ (*dst_ptr) = src; (*dst_struct_ptr).arr = src; (*dst_array_ptr)[0] = src; - return (((*dst_ptr)[0] + (*dst_struct_ptr).arr[0]) + (*dst_array_ptr)[0][0]); + return as_type<int>((as_type<uint>(as_type<int>((as_type<uint>((*dst_ptr)[0]) + as_type<uint>((*dst_struct_ptr).arr[0])))) + as_type<uint>((*dst_array_ptr)[0][0]))); } kernel void tint_symbol(device int* s [[buffer(0)]]) {