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 {
149149
150150 @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) {
153153 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage });
154154 @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage });
155155 @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 {
7878 .d,
7979 .f,
8080 .m,
81 .relax,
8281 }),
8382 };
8483
......@@ -92,7 +91,6 @@ pub const cpu = struct {
9291 .d,
9392 .f,
9493 .m,
95 .relax,
9694 }),
9795 };
9896
src/ir.cpp+9-4
......@@ -11873,10 +11873,15 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
1187311873 }
1187411874
1187511875 if (wanted_type->id == ZigTypeIdInt && actual_type->id == ZigTypeIdInt) {
11876 result.id = ConstCastResultIdIntShorten;
11877 result.data.int_shorten = heap::c_allocator.allocate_nonzero<ConstCastIntShorten>(1);
11878 result.data.int_shorten->wanted_type = wanted_type;
11879 result.data.int_shorten->actual_type = actual_type;
11876 if (wanted_type->data.integral.is_signed != actual_type->data.integral.is_signed ||
11877 wanted_type->data.integral.bit_count != actual_type->data.integral.bit_count)
11878 {
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 }
1188011885 return result;
1188111886 }
1188211887
test/stage1/behavior/atomics.zig+2-2
......@@ -146,8 +146,8 @@ fn testAtomicStore() void {
146146}
147147
148148test "atomicrmw with floats" {
149 if (builtin.arch == .aarch64 or builtin.arch == .arm)
150 return;
149 if (builtin.arch == .aarch64 or builtin.arch == .arm or builtin.arch == .riscv64)
150 return error.SkipZigTest;
151151 testAtomicRmwFloat();
152152}
153153
test/stage1/behavior/cast.zig+13
......@@ -782,3 +782,16 @@ test "cast between [*c]T and ?[*:0]T on fn parameter" {
782782 };
783783 S.doTheTest();
784784}
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}