This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = @import("std").debug.assert; | |
// zig: ../src/analyze.cpp:499: ZigType* get_pointer_to_type_extra(CodeGen*, ZigType*, bool, bool, PtrLen, uint32_t, uint32_t, uint32_t): Assertion `byte_alignment == 0' failed. | |
// Aborted (core dumped) | |
test "u0-packed-struct-fails" { | |
const S = packed struct { f0: u0, }; | |
var s = S { .f0 = 0, }; | |
assert(s.f0 == 0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const assert = std.debug.assert; | |
test "u0-memory-address" { | |
var one: u1 = 1; | |
var zero: u0 = 0; | |
var pZero = &zero; | |
assert(pZero == &zero); | |
// $ zig test u0.zig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const assert = std.debug.assert; | |
const warn = std.debug.warn; | |
const builtin = @import("builtin"); | |
const TypeId = builtin.TypeId; | |
test "u0" { | |
var zero: u0 = 0; | |
var pZeroOptional: ?*u0 = &zero; | |
assert(pZeroOptional != null); // this is true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$ zig test opaquetype.zig | |
//opaquetype.zig:8:30: error: parameter of type '(anonymous opaque at opaquetype.zig:12:30)' not allowed | |
// fn getValue(pOpaqueSelf: @OpaqueType()) u32 { | |
// ^ | |
const assert = @import("std").debug.assert; | |
const S = struct { | |
const Self = @This(); | |
value: u32, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$ zig test make_struct.zig | |
// make_struct.zig:20:7: error: no member named 'int64' in struct 'makeStruct((struct []const u8 constant),i64)' | |
// v1.int64 = -123; | |
// Seems the "name" parameter needs to be a "symbol" | |
// and the return would be something like: | |
// return struct { @symbol(name): T, }; | |
fn makeStruct(comptime name: []const u8, comptime T: type) type { | |
return struct { name: T, }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[00:07:10] C:\projects\zig-d3l86\llvm+clang-6.0.0-win64-msvc-release\include\llvm/ADT/IntrusiveRefCntPtr.h(167): warning C4800: 'clang::TargetInfo *const ': forcing value to bool 'true' or 'false' (performance warning) [C:\projects\zig-d3l86\build-msvc-release\zig.vcxproj] | |
[00:07:10] C:\projects\zig-d3l86\llvm+clang-6.0.0-win64-msvc-release\include\llvm/ADT/IntrusiveRefCntPtr.h(167): warning C4800: 'clang::SourceManager *const ': forcing value to bool 'true' or 'false' (performance warning) [C:\projects\zig-d3l86\build-msvc-release\zig.vcxproj] | |
[00:07:10] C:\projects\zig-d3l86\llvm+clang-6.0.0-win64-msvc-release\include\llvm/ADT/IntrusiveRefCntPtr.h(167): warning C4800: 'clang::FileManager *const ': forcing value to bool 'true' or 'false' (performance warning) [C:\projects\zig-d3l86\build-msvc-release\zig.vcxproj] | |
[00:07:10] C:\projects\zig-d3l86\llvm+clang-6.0.0-win64-msvc-release\include\llvm/ADT/IntrusiveRefCntPtr.h(167): warning C4800: 'clang::vfs::FileSystem *const ': forcing value to bool 'true' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const warn = std.debug.warn; | |
fn Buffer(comptime buffer_size: usize) type { | |
return struct { | |
const Self = this; | |
pub buffer: [buffer_size]u8, | |
// Initialize if allocated in the stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@df5469b996ee:/home/pony/wink/prgs/pony/ponyc# gdb -q --args ./build/debug/libponyc.tests --gtest_filter=CodegenOptimisationTest.MergeSendMessageReordering | |
Reading symbols from ./build/debug/libponyc.tests...done. | |
(gdb) set pagination off | |
(gdb) set disassembly-flavor intel | |
(gdb) break _ZN4llvm15RuntimeDyldImpl14loadObjectImplERKNS_6object10ObjectFileE | |
Function "_ZN4llvm15RuntimeDyldImpl14loadObjectImplERKNS_6object10ObjectFileE" not defined. | |
Make breakpoint pending on future shared library load? (y or [n]) y | |
Breakpoint 1 (_ZN4llvm15RuntimeDyldImpl14loadObjectImplERKNS_6object10ObjectFileE) pending. | |
(gdb) r | |
Starting program: /home/pony/wink/prgs/pony/ponyc/build/debug/libponyc.tests --gtest_filter=CodegenOptimisationTest.MergeSendMessageReordering |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dump of assembler code for function _ZN4llvm15RuntimeDyldImpl14loadObjectImplERKNS_6object10ObjectFileE: | |
=> 0x00007ffff65fc870 <+0>: push r15 | |
0x00007ffff65fc872 <+2>: push r14 | |
0x00007ffff65fc874 <+4>: push r13 | |
0x00007ffff65fc876 <+6>: push r12 | |
0x00007ffff65fc878 <+8>: mov r12,rdx | |
0x00007ffff65fc87b <+11>: push rbp | |
0x00007ffff65fc87c <+12>: push rbx | |
0x00007ffff65fc87d <+13>: mov r13,rsi | |
0x00007ffff65fc880 <+16>: sub rsp,0x158 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label onto | |
# Branch Merging-in-work-from-branch | |
reset [new root] | |
pick 027dbf80 Initial commit | |
pick cc10751a Adding benchmark namespace and removing broken flags | |
pick e65ca767 Fix printing of time | |
label branch-point | |
pick bd5c1cd7 Remove duplicated macros header | |
pick ab8645c9 benchmark_min_time now works as expected |