| ... | ... | @@ -16278,6 +16278,193 @@ test "struct [5]f32" { |
| 16278 | 16278 | c_test_struct_array_5_f32(); |
| 16279 | 16279 | } |
| 16280 | 16280 | |
| 16281 | const Struct_array_0_sentinel_f32 = extern struct { |
| 16282 | a: [0:0x1e1]f32, |
| 16283 | }; |
| 16284 | |
| 16285 | export fn zig_ret_struct_array_0_sentinel_f32() Struct_array_0_sentinel_f32 { |
| 16286 | return .{ .a = .{} }; |
| 16287 | } |
| 16288 | export fn zig_struct_array_0_sentinel_f32(s: Struct_array_0_sentinel_f32, i: usize) void { |
| 16289 | var sentinel_index: usize = 0; |
| 16290 | _ = &sentinel_index; |
| 16291 | expect(s.a[sentinel_index] == 0x1e1) catch @panic("test failure"); |
| 16292 | expect(i == 1) catch @panic("test failure"); |
| 16293 | } |
| 16294 | |
| 16295 | extern fn c_ret_struct_array_0_sentinel_f32() Struct_array_0_sentinel_f32; |
| 16296 | extern fn c_struct_array_0_sentinel_f32(Struct_array_0_sentinel_f32, usize) void; |
| 16297 | extern fn c_test_struct_array_0_sentinel_f32() void; |
| 16298 | |
| 16299 | test "struct [0:sentinel]f32" { |
| 16300 | if (builtin.cpu.arch.isAARCH64()) return error.SkipZigTest; |
| 16301 | if (builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 16302 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16303 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16304 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 16305 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 16306 | if (builtin.cpu.arch.isWasm()) return error.SkipZigTest; |
| 16307 | |
| 16308 | var sentinel_index: usize = 0; |
| 16309 | _ = &sentinel_index; |
| 16310 | const s = c_ret_struct_array_0_sentinel_f32(); |
| 16311 | try expect(s.a[sentinel_index] == 0x1e1); |
| 16312 | c_struct_array_0_sentinel_f32(.{ .a = .{} }, 2); |
| 16313 | c_test_struct_array_0_sentinel_f32(); |
| 16314 | } |
| 16315 | |
| 16316 | const Struct_array_1_sentinel_f32 = extern struct { |
| 16317 | a: [1:0x1e1]f32, |
| 16318 | }; |
| 16319 | |
| 16320 | export fn zig_ret_struct_array_1_sentinel_f32() Struct_array_1_sentinel_f32 { |
| 16321 | return .{ .a = .{1} }; |
| 16322 | } |
| 16323 | export fn zig_struct_array_1_sentinel_f32(s: Struct_array_1_sentinel_f32, i: usize) void { |
| 16324 | var sentinel_index: usize = 1; |
| 16325 | _ = &sentinel_index; |
| 16326 | expect(s.a[0] == 2) catch @panic("test failure"); |
| 16327 | expect(s.a[sentinel_index] == 0x1e1) catch @panic("test failure"); |
| 16328 | expect(i == 3) catch @panic("test failure"); |
| 16329 | } |
| 16330 | |
| 16331 | extern fn c_ret_struct_array_1_sentinel_f32() Struct_array_1_sentinel_f32; |
| 16332 | extern fn c_struct_array_1_sentinel_f32(Struct_array_1_sentinel_f32, usize) void; |
| 16333 | extern fn c_test_struct_array_1_sentinel_f32() void; |
| 16334 | |
| 16335 | test "struct [1:sentinel]f32" { |
| 16336 | if (builtin.cpu.arch.isAARCH64()) return error.SkipZigTest; |
| 16337 | if (builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 16338 | if (builtin.cpu.arch == .loongarch64 and builtin.abi.float() == .hard) return error.SkipZigTest; |
| 16339 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16340 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16341 | if (builtin.cpu.arch.isRISCV()) return error.SkipZigTest; |
| 16342 | |
| 16343 | var sentinel_index: usize = 1; |
| 16344 | _ = &sentinel_index; |
| 16345 | const s = c_ret_struct_array_1_sentinel_f32(); |
| 16346 | try expect(s.a[0] == 4); |
| 16347 | try expect(s.a[sentinel_index] == 0x1e1); |
| 16348 | c_struct_array_1_sentinel_f32(.{ .a = .{5} }, 6); |
| 16349 | c_test_struct_array_1_sentinel_f32(); |
| 16350 | } |
| 16351 | |
| 16352 | const Struct_array_2_sentinel_f32 = extern struct { |
| 16353 | a: [2:0x1e1]f32, |
| 16354 | }; |
| 16355 | |
| 16356 | export fn zig_ret_struct_array_2_sentinel_f32() Struct_array_2_sentinel_f32 { |
| 16357 | return .{ .a = .{ 1, 2 } }; |
| 16358 | } |
| 16359 | export fn zig_struct_array_2_sentinel_f32(s: Struct_array_2_sentinel_f32, i: usize) void { |
| 16360 | var sentinel_index: usize = 2; |
| 16361 | _ = &sentinel_index; |
| 16362 | expect(s.a[0] == 3) catch @panic("test failure"); |
| 16363 | expect(s.a[1] == 4) catch @panic("test failure"); |
| 16364 | expect(s.a[sentinel_index] == 0x1e1) catch @panic("test failure"); |
| 16365 | expect(i == 5) catch @panic("test failure"); |
| 16366 | } |
| 16367 | |
| 16368 | extern fn c_ret_struct_array_2_sentinel_f32() Struct_array_2_sentinel_f32; |
| 16369 | extern fn c_struct_array_2_sentinel_f32(Struct_array_2_sentinel_f32, usize) void; |
| 16370 | extern fn c_test_struct_array_2_sentinel_f32() void; |
| 16371 | |
| 16372 | test "struct [2:sentinel]f32" { |
| 16373 | if (builtin.cpu.arch.isAARCH64()) return error.SkipZigTest; |
| 16374 | if (builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 16375 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 16376 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16377 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16378 | |
| 16379 | var sentinel_index: usize = 2; |
| 16380 | _ = &sentinel_index; |
| 16381 | const s = c_ret_struct_array_2_sentinel_f32(); |
| 16382 | try expect(s.a[0] == 6); |
| 16383 | try expect(s.a[1] == 7); |
| 16384 | try expect(s.a[sentinel_index] == 0x1e1); |
| 16385 | c_struct_array_2_sentinel_f32(.{ .a = .{ 8, 9 } }, 10); |
| 16386 | c_test_struct_array_2_sentinel_f32(); |
| 16387 | } |
| 16388 | |
| 16389 | const Struct_array_3_sentinel_f32 = extern struct { |
| 16390 | a: [3:0x1e1]f32, |
| 16391 | }; |
| 16392 | |
| 16393 | export fn zig_ret_struct_array_3_sentinel_f32() Struct_array_3_sentinel_f32 { |
| 16394 | return .{ .a = .{ 1, 2, 3 } }; |
| 16395 | } |
| 16396 | export fn zig_struct_array_3_sentinel_f32(s: Struct_array_3_sentinel_f32, i: usize) void { |
| 16397 | var sentinel_index: usize = 3; |
| 16398 | _ = &sentinel_index; |
| 16399 | expect(s.a[0] == 4) catch @panic("test failure"); |
| 16400 | expect(s.a[1] == 5) catch @panic("test failure"); |
| 16401 | expect(s.a[2] == 6) catch @panic("test failure"); |
| 16402 | expect(s.a[sentinel_index] == 0x1e1) catch @panic("test failure"); |
| 16403 | expect(i == 7) catch @panic("test failure"); |
| 16404 | } |
| 16405 | |
| 16406 | extern fn c_ret_struct_array_3_sentinel_f32() Struct_array_3_sentinel_f32; |
| 16407 | extern fn c_struct_array_3_sentinel_f32(Struct_array_3_sentinel_f32, usize) void; |
| 16408 | extern fn c_test_struct_array_3_sentinel_f32() void; |
| 16409 | |
| 16410 | test "struct [3:sentinel]f32" { |
| 16411 | if (builtin.cpu.arch.isAARCH64()) return error.SkipZigTest; |
| 16412 | if (builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 16413 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 16414 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16415 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16416 | |
| 16417 | var sentinel_index: usize = 3; |
| 16418 | _ = &sentinel_index; |
| 16419 | const s = c_ret_struct_array_3_sentinel_f32(); |
| 16420 | try expect(s.a[0] == 8); |
| 16421 | try expect(s.a[1] == 9); |
| 16422 | try expect(s.a[2] == 10); |
| 16423 | try expect(s.a[sentinel_index] == 0x1e1); |
| 16424 | c_struct_array_3_sentinel_f32(.{ .a = .{ 11, 12, 13 } }, 14); |
| 16425 | c_test_struct_array_3_sentinel_f32(); |
| 16426 | } |
| 16427 | |
| 16428 | const Struct_array_4_sentinel_f32 = extern struct { |
| 16429 | a: [4:0x1e1]f32, |
| 16430 | }; |
| 16431 | |
| 16432 | export fn zig_ret_struct_array_4_sentinel_f32() Struct_array_4_sentinel_f32 { |
| 16433 | return .{ .a = .{ 1, 2, 3, 4 } }; |
| 16434 | } |
| 16435 | export fn zig_struct_array_4_sentinel_f32(s: Struct_array_4_sentinel_f32, i: usize) void { |
| 16436 | var sentinel_index: usize = 4; |
| 16437 | _ = &sentinel_index; |
| 16438 | expect(s.a[0] == 5) catch @panic("test failure"); |
| 16439 | expect(s.a[1] == 6) catch @panic("test failure"); |
| 16440 | expect(s.a[2] == 7) catch @panic("test failure"); |
| 16441 | expect(s.a[3] == 8) catch @panic("test failure"); |
| 16442 | expect(s.a[sentinel_index] == 0x1e1) catch @panic("test failure"); |
| 16443 | expect(i == 9) catch @panic("test failure"); |
| 16444 | } |
| 16445 | |
| 16446 | extern fn c_ret_struct_array_4_sentinel_f32() Struct_array_4_sentinel_f32; |
| 16447 | extern fn c_struct_array_4_sentinel_f32(Struct_array_4_sentinel_f32, usize) void; |
| 16448 | extern fn c_test_struct_array_4_sentinel_f32() void; |
| 16449 | |
| 16450 | test "struct [4:sentinel]f32" { |
| 16451 | if (builtin.cpu.arch.isArm()) return error.SkipZigTest; |
| 16452 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 16453 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 16454 | if (builtin.cpu.arch.isPowerPC()) return error.SkipZigTest; |
| 16455 | |
| 16456 | var sentinel_index: usize = 4; |
| 16457 | _ = &sentinel_index; |
| 16458 | const s = c_ret_struct_array_4_sentinel_f32(); |
| 16459 | try expect(s.a[0] == 10); |
| 16460 | try expect(s.a[1] == 11); |
| 16461 | try expect(s.a[2] == 12); |
| 16462 | try expect(s.a[3] == 13); |
| 16463 | try expect(s.a[sentinel_index] == 0x1e1); |
| 16464 | c_struct_array_4_sentinel_f32(.{ .a = .{ 14, 15, 16, 17 } }, 18); |
| 16465 | c_test_struct_array_4_sentinel_f32(); |
| 16466 | } |
| 16467 | |
| 16281 | 16468 | const Struct_f32a8 = extern struct { |
| 16282 | 16469 | a: f32 align(8), |
| 16283 | 16470 | }; |