| author | |
| committer | |
| log | 5eafc10bf41451fb694f324dcaefe5c458e1ca3a |
| tree | 45ee1879f0a2b0b6b198cb4136f04e5cc1868de9 |
| parent | c126a1018eec54c568aaa642013e3c86bdd6d3e4 |
9 files changed, 4 insertions(+), 22 deletions(-)
src/codegen/c.zig+4-3| ... | @@ -393,7 +393,10 @@ pub const DeclGen = struct { | ... | @@ -393,7 +393,10 @@ pub const DeclGen = struct { |
| 393 | val: Value, | 393 | val: Value, |
| 394 | decl_index: Decl.Index, | 394 | decl_index: Decl.Index, |
| 395 | ) error{ OutOfMemory, AnalysisFail }!void { | 395 | ) error{ OutOfMemory, AnalysisFail }!void { |
| 396 | if (ty.isPtrAtRuntime() and !ty.elemType2().isFnOrHasRuntimeBits()) { | 396 | const decl = dg.module.declPtr(decl_index); |
| 397 | assert(decl.has_tv); | ||
| 398 | |||
| 399 | if (ty.isPtrAtRuntime() and !decl.ty.isFnOrHasRuntimeBits()) { | ||
| 397 | return dg.writeCValue(writer, CValue{ .undefined_ptr = ty }); | 400 | return dg.writeCValue(writer, CValue{ .undefined_ptr = ty }); |
| 398 | } | 401 | } |
| 399 | 402 | ||
| ... | @@ -409,8 +412,6 @@ pub const DeclGen = struct { | ... | @@ -409,8 +412,6 @@ pub const DeclGen = struct { |
| 409 | return; | 412 | return; |
| 410 | } | 413 | } |
| 411 | 414 | ||
| 412 | const decl = dg.module.declPtr(decl_index); | ||
| 413 | assert(decl.has_tv); | ||
| 414 | // We shouldn't cast C function pointers as this is UB (when you call | 415 | // We shouldn't cast C function pointers as this is UB (when you call |
| 415 | // them). The analysis until now should ensure that the C function | 416 | // them). The analysis until now should ensure that the C function |
| 416 | // pointers are compatible. If they are not, then there is a bug | 417 | // pointers are compatible. If they are not, then there is a bug |
test/behavior/bugs/12984.zig-1| ... | @@ -14,7 +14,6 @@ pub const CustomDraw = DeleagateWithContext(fn (?OnConfirm) void); | ... | @@ -14,7 +14,6 @@ pub const CustomDraw = DeleagateWithContext(fn (?OnConfirm) void); |
| 14 | test "simple test" { | 14 | test "simple test" { |
| 15 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 15 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 17 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 18 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 17 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 19 | 18 | ||
| 20 | var c: CustomDraw = undefined; | 19 | var c: CustomDraw = undefined; |
test/behavior/bugs/1914.zig-1| ... | @@ -29,6 +29,5 @@ pub const B2 = struct { | ... | @@ -29,6 +29,5 @@ pub const B2 = struct { |
| 29 | var b_value = B2{ .pointer_array = &[_]*A2{} }; | 29 | var b_value = B2{ .pointer_array = &[_]*A2{} }; |
| 30 | 30 | ||
| 31 | test "basic stuff" { | 31 | test "basic stuff" { |
| 32 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 33 | std.debug.assert(&b_value == &b_value); | 32 | std.debug.assert(&b_value == &b_value); |
| 34 | } | 33 | } |
test/behavior/cast.zig-7| ... | @@ -450,7 +450,6 @@ fn castToOptionalTypeError(z: i32) !void { | ... | @@ -450,7 +450,6 @@ fn castToOptionalTypeError(z: i32) !void { |
| 450 | 450 | ||
| 451 | test "implicitly cast from [0]T to anyerror![]T" { | 451 | test "implicitly cast from [0]T to anyerror![]T" { |
| 452 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 452 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 453 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 454 | 453 | ||
| 455 | try testCastZeroArrayToErrSliceMut(); | 454 | try testCastZeroArrayToErrSliceMut(); |
| 456 | comptime try testCastZeroArrayToErrSliceMut(); | 455 | comptime try testCastZeroArrayToErrSliceMut(); |
| ... | @@ -466,7 +465,6 @@ fn gimmeErrOrSlice() anyerror![]u8 { | ... | @@ -466,7 +465,6 @@ fn gimmeErrOrSlice() anyerror![]u8 { |
| 466 | 465 | ||
| 467 | test "peer type resolution: [0]u8, []const u8, and anyerror![]u8" { | 466 | test "peer type resolution: [0]u8, []const u8, and anyerror![]u8" { |
| 468 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 467 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 469 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 470 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 468 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 471 | 469 | ||
| 472 | const S = struct { | 470 | const S = struct { |
| ... | @@ -810,7 +808,6 @@ test "peer type resolution: error union after non-error" { | ... | @@ -810,7 +808,6 @@ test "peer type resolution: error union after non-error" { |
| 810 | test "peer cast *[0]T to E![]const T" { | 808 | test "peer cast *[0]T to E![]const T" { |
| 811 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 809 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 812 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 810 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 813 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 814 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 811 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 815 | 812 | ||
| 816 | var buffer: [5]u8 = "abcde".*; | 813 | var buffer: [5]u8 = "abcde".*; |
| ... | @@ -825,7 +822,6 @@ test "peer cast *[0]T to E![]const T" { | ... | @@ -825,7 +822,6 @@ test "peer cast *[0]T to E![]const T" { |
| 825 | test "peer cast *[0]T to []const T" { | 822 | test "peer cast *[0]T to []const T" { |
| 826 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 823 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 827 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 824 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 828 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 829 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 825 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 830 | 826 | ||
| 831 | var buffer: [5]u8 = "abcde".*; | 827 | var buffer: [5]u8 = "abcde".*; |
| ... | @@ -1131,7 +1127,6 @@ fn returnNullLitFromOptionalTypeErrorRef() anyerror!?*A { | ... | @@ -1131,7 +1127,6 @@ fn returnNullLitFromOptionalTypeErrorRef() anyerror!?*A { |
| 1131 | 1127 | ||
| 1132 | test "peer type resolution: [0]u8 and []const u8" { | 1128 | test "peer type resolution: [0]u8 and []const u8" { |
| 1133 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 1129 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1134 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 1135 | 1130 | ||
| 1136 | try expect(peerTypeEmptyArrayAndSlice(true, "hi").len == 0); | 1131 | try expect(peerTypeEmptyArrayAndSlice(true, "hi").len == 0); |
| 1137 | try expect(peerTypeEmptyArrayAndSlice(false, "hi").len == 1); | 1132 | try expect(peerTypeEmptyArrayAndSlice(false, "hi").len == 1); |
| ... | @@ -1214,7 +1209,6 @@ fn incrementVoidPtrValue(value: ?*anyopaque) void { | ... | @@ -1214,7 +1209,6 @@ fn incrementVoidPtrValue(value: ?*anyopaque) void { |
| 1214 | 1209 | ||
| 1215 | test "implicit cast *[0]T to E![]const u8" { | 1210 | test "implicit cast *[0]T to E![]const u8" { |
| 1216 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 1211 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 1217 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 1218 | 1212 | ||
| 1219 | var x = @as(anyerror![]const u8, &[0]u8{}); | 1213 | var x = @as(anyerror![]const u8, &[0]u8{}); |
| 1220 | try expect((x catch unreachable).len == 0); | 1214 | try expect((x catch unreachable).len == 0); |
| ... | @@ -1386,7 +1380,6 @@ test "coerce undefined single-item pointer of array to error union of slice" { | ... | @@ -1386,7 +1380,6 @@ test "coerce undefined single-item pointer of array to error union of slice" { |
| 1386 | } | 1380 | } |
| 1387 | 1381 | ||
| 1388 | test "pointer to empty struct literal to mutable slice" { | 1382 | test "pointer to empty struct literal to mutable slice" { |
| 1389 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 1390 | var x: []i32 = &.{}; | 1383 | var x: []i32 = &.{}; |
| 1391 | try expect(x.len == 0); | 1384 | try expect(x.len == 0); |
| 1392 | } | 1385 | } |
test/behavior/fn.zig-1| ... | @@ -405,7 +405,6 @@ test "function with inferred error set but returning no error" { | ... | @@ -405,7 +405,6 @@ test "function with inferred error set but returning no error" { |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | test "import passed byref to function in return type" { | 407 | test "import passed byref to function in return type" { |
| 408 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 409 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 408 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 410 | 409 | ||
| 411 | const S = struct { | 410 | const S = struct { |
test/behavior/slice.zig-3| ... | @@ -169,7 +169,6 @@ test "comptime pointer cast array and then slice" { | ... | @@ -169,7 +169,6 @@ test "comptime pointer cast array and then slice" { |
| 169 | 169 | ||
| 170 | test "slicing zero length array" { | 170 | test "slicing zero length array" { |
| 171 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 171 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 172 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 173 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 172 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 174 | 173 | ||
| 175 | const s1 = ""[0..]; | 174 | const s1 = ""[0..]; |
| ... | @@ -206,8 +205,6 @@ test "slice string literal has correct type" { | ... | @@ -206,8 +205,6 @@ test "slice string literal has correct type" { |
| 206 | } | 205 | } |
| 207 | 206 | ||
| 208 | test "result location zero sized array inside struct field implicit cast to slice" { | 207 | test "result location zero sized array inside struct field implicit cast to slice" { |
| 209 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 210 | |||
| 211 | const E = struct { | 208 | const E = struct { |
| 212 | entries: []u32, | 209 | entries: []u32, |
| 213 | }; | 210 | }; |
test/behavior/struct.zig-1| ... | @@ -365,7 +365,6 @@ const EmptyStruct = struct { | ... | @@ -365,7 +365,6 @@ const EmptyStruct = struct { |
| 365 | 365 | ||
| 366 | test "align 1 field before self referential align 8 field as slice return type" { | 366 | test "align 1 field before self referential align 8 field as slice return type" { |
| 367 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 367 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 368 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 369 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 368 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 370 | 369 | ||
| 371 | const result = alloc(Expr); | 370 | const result = alloc(Expr); |
test/behavior/struct_contains_slice_of_itself.zig-2| ... | @@ -12,7 +12,6 @@ const NodeAligned = struct { | ... | @@ -12,7 +12,6 @@ const NodeAligned = struct { |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | test "struct contains slice of itself" { | 14 | test "struct contains slice of itself" { |
| 15 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 17 | 16 | ||
| 18 | var other_nodes = [_]Node{ | 17 | var other_nodes = [_]Node{ |
| ... | @@ -52,7 +51,6 @@ test "struct contains slice of itself" { | ... | @@ -52,7 +51,6 @@ test "struct contains slice of itself" { |
| 52 | } | 51 | } |
| 53 | 52 | ||
| 54 | test "struct contains aligned slice of itself" { | 53 | test "struct contains aligned slice of itself" { |
| 55 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 56 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 54 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 57 | 55 | ||
| 58 | var other_nodes = [_]NodeAligned{ | 56 | var other_nodes = [_]NodeAligned{ |
test/behavior/tuple.zig-3| ... | @@ -257,7 +257,6 @@ test "initializing anon struct with mixed comptime-runtime fields" { | ... | @@ -257,7 +257,6 @@ test "initializing anon struct with mixed comptime-runtime fields" { |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | test "tuple in tuple passed to generic function" { | 259 | test "tuple in tuple passed to generic function" { |
| 260 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 261 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 260 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 262 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 261 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 263 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 262 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| ... | @@ -277,7 +276,6 @@ test "tuple in tuple passed to generic function" { | ... | @@ -277,7 +276,6 @@ test "tuple in tuple passed to generic function" { |
| 277 | } | 276 | } |
| 278 | 277 | ||
| 279 | test "coerce tuple to tuple" { | 278 | test "coerce tuple to tuple" { |
| 280 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 281 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 279 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 282 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 280 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 283 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 281 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| ... | @@ -292,7 +290,6 @@ test "coerce tuple to tuple" { | ... | @@ -292,7 +290,6 @@ test "coerce tuple to tuple" { |
| 292 | } | 290 | } |
| 293 | 291 | ||
| 294 | test "tuple type with void field" { | 292 | test "tuple type with void field" { |
| 295 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 296 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 293 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 297 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 294 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 298 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 295 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |