authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-11 13:12:42-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-02-11 13:12:42-05:00
logab4ea5d3cf5a96cd596df14515521843ca4dccad
tree53dbd5a50a589cd0c93db62e19a4a36f619f3401
parente624c862894ec50998aafb3026d4ed45208acd6d
parent6c05f0949aa09ac41268097161bacf8dc047e195
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #4433 from LemonBoy/ohno

Trivial patchset

5 files changed, 25 insertions(+), 9 deletions(-)

lib/std/special/compiler_rt.zig+1-1
...@@ -149,7 +149,7 @@ comptime {...@@ -149,7 +149,7 @@ comptime {
149149
150 @export(@import("compiler_rt/clzsi2.zig").__clzsi2, .{ .name = "__clzsi2", .linkage = linkage });150 @export(@import("compiler_rt/clzsi2.zig").__clzsi2, .{ .name = "__clzsi2", .linkage = linkage });
151151
152 if (builtin.arch.isARM() and !is_test) {152 if ((builtin.arch.isARM() or builtin.arch.isThumb()) and !is_test) {
153 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage });153 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage });
154 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage });154 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage });
155 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage });155 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage });
lib/std/target/riscv.zig-2
...@@ -78,7 +78,6 @@ pub const cpu = struct {...@@ -78,7 +78,6 @@ pub const cpu = struct {
78 .d,78 .d,
79 .f,79 .f,
80 .m,80 .m,
81 .relax,
82 }),81 }),
83 };82 };
8483
...@@ -92,7 +91,6 @@ pub const cpu = struct {...@@ -92,7 +91,6 @@ pub const cpu = struct {
92 .d,91 .d,
93 .f,92 .f,
94 .m,93 .m,
95 .relax,
96 }),94 }),
97 };95 };
9896
src/ir.cpp+9-4
...@@ -11873,10 +11873,15 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted...@@ -11873,10 +11873,15 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
11873 }11873 }
1187411874
11875 if (wanted_type->id == ZigTypeIdInt && actual_type->id == ZigTypeIdInt) {11875 if (wanted_type->id == ZigTypeIdInt && actual_type->id == ZigTypeIdInt) {
11876 result.id = ConstCastResultIdIntShorten;11876 if (wanted_type->data.integral.is_signed != actual_type->data.integral.is_signed ||
11877 result.data.int_shorten = heap::c_allocator.allocate_nonzero<ConstCastIntShorten>(1);11877 wanted_type->data.integral.bit_count != actual_type->data.integral.bit_count)
11878 result.data.int_shorten->wanted_type = wanted_type;11878 {
11879 result.data.int_shorten->actual_type = actual_type;11879 result.id = ConstCastResultIdIntShorten;
11880 result.data.int_shorten = heap::c_allocator.allocate_nonzero<ConstCastIntShorten>(1);
11881 result.data.int_shorten->wanted_type = wanted_type;
11882 result.data.int_shorten->actual_type = actual_type;
11883 return result;
11884 }
11880 return result;11885 return result;
11881 }11886 }
1188211887
test/stage1/behavior/atomics.zig+2-2
...@@ -146,8 +146,8 @@ fn testAtomicStore() void {...@@ -146,8 +146,8 @@ fn testAtomicStore() void {
146}146}
147147
148test "atomicrmw with floats" {148test "atomicrmw with floats" {
149 if (builtin.arch == .aarch64 or builtin.arch == .arm)149 if (builtin.arch == .aarch64 or builtin.arch == .arm or builtin.arch == .riscv64)
150 return;150 return error.SkipZigTest;
151 testAtomicRmwFloat();151 testAtomicRmwFloat();
152}152}
153153
test/stage1/behavior/cast.zig+13
...@@ -782,3 +782,16 @@ test "cast between [*c]T and ?[*:0]T on fn parameter" {...@@ -782,3 +782,16 @@ test "cast between [*c]T and ?[*:0]T on fn parameter" {
782 };782 };
783 S.doTheTest();783 S.doTheTest();
784}784}
785
786test "cast between C pointer with different but compatible types" {
787 const S = struct {
788 fn foo(arg: [*]c_ushort) u16 {
789 return arg[0];
790 }
791 fn doTheTest() void {
792 var x = [_]u16{ 4, 2, 1, 3 };
793 expect(foo(@ptrCast([*]u16, &x)) == 4);
794 }
795 };
796 S.doTheTest();
797}