I am working on package [BitStructs](https://github.com/rryi/BitStructs.jl) and …encounter a strange error running my benchmarks with julia 1.6.0-RC1.
### Environment:
System Ryzen 1700, 16 GB RAM, Windows 10 Pro, version 20H2
Julia 64 bit 1.6.0-rc1 (2021-02-06)
Package https://github.com/rryi/BitStructs.jl, commit 50ea2e46b77d098ba61ab65d15e31aa289848e24
### Steps to reproduce:
* use a Win10 machine
* install julia 1.6.0 RC1 64 bit
* download/clone package BitStructs.jl to a local directory
* enter that directory in a CMD shell
* start julia
* activate package dir
* add BenchmarkTools (I did it some days ago with v0.5.0. Retry with version 0.6.0 had the same result)
* exit julia
* execute in CMD shell: julia test\crash.jl
My log for that, showing the crash under 1.6.0RC1
```
Microsoft Windows [Version 10.0.19042.867]
(c) 2020 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\RR\julia\BitStructs>julia test\crash.jl
Activating environment at `C:\Users\RR\julia\BitStructs\Project.toml`
S(S_RUNNING, BIGMINUS, Float16(-1.0), true, false, false, true, 0, 'a', 'c', 0x0001, 0x0002, 3, 4)BitStruct{NamedTuple{(:status, :strange, :sign, :flag1, :flag2, :flag3, :flag4, :bit1, :ac, :lc, :id1, :id2, :delta1, :delta2), Tuple{ProcStatus, Strange, Sign, Bool, Bool, Bool, Bool, BInt{1}, AsciiChar, Latin1Char, BUInt{9}, BUInt{12}, BInt{9}, BInt{9}}}} 0x0200c00802c78531
status::ProcStatus = S_RUNNING
strange::Strange = BIGMINUS
sign::Sign = -1.0
flag1::Bool = true
flag2::Bool = false
flag3::Bool = false
flag4::Bool = true
bit1::BInt{1} = 0
ac::AsciiChar = 'a'
lc::Latin1Char = 'c'
id1::BUInt{9} = 0x0000000000000001
id2::BUInt{12} = 0x0000000000000002
delta1::BInt{9} = 3
delta2::BInt{9} = 4
end
struct/BitStruct simple field access ENTER:
2.700 ns (0 allocations: 0 bytes)
2.700 ns (0 allocations: 0 bytes)
struct/BitStruct field access in @noinline function ENTER:
2.600 ns (0 allocations: 0 bytes)
9.500 ns (0 allocations: 0 bytes)
set 2 fields on struct then BitStruct ENTER:
2.600 ns (0 allocations: 0 bytes)
358.571 ns (3 allocations: 48 bytes)
set 2 fields on struct then BitStruct (large struct) ENTER:
2.600 ns (0 allocations: 0 bytes)
the statements executed by set2fields run, if executed directly
BitStruct{NamedTuple{(:status, :strange, :sign, :flag1, :flag2, :flag3, :flag4, :bit1, :ac, :lc, :id1, :id2, :delta1, :delta2), Tuple{ProcStatus, Strange, Sign, Bool, Bool, Bool, Bool, BInt{1}, AsciiChar, Latin1Char, BUInt{9}, BUInt{12}, BInt{9}, BInt{9}}}} 0x0200c00804c78511
status::ProcStatus = S_RUNNING
strange::Strange = BIGMINUS
sign::Sign = -1.0
flag1::Bool = false
flag2::Bool = false
flag3::Bool = false
flag4::Bool = true
bit1::BInt{1} = 0
ac::AsciiChar = 'a'
lc::Latin1Char = 'c'
id1::BUInt{9} = 0x0000000000000002
id2::BUInt{12} = 0x0000000000000002
delta1::BInt{9} = 3
delta2::BInt{9} = 4
end
Calling set2fields(bs) causes a crash
Unreachable reached at 00000000610aa1b6
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ILLEGAL_INSTRUCTION at 0x610aa1b6 -- set2fields at C:\Users\RR\julia\BitStructs\test\benchmark.jl:293
in expression starting at C:\Users\RR\julia\BitStructs\test\benchmark.jl:316
set2fields at C:\Users\RR\julia\BitStructs\test\benchmark.jl:293
unknown function (ip: 00000000610aa1d9)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1703 [inlined]
do_call at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:115
eval_value at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:204
eval_stmt_value at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:155 [inlined]
eval_body at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:575
jl_interpret_toplevel_thunk at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:669
jl_toplevel_eval_flex at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:879
jl_toplevel_eval_flex at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:827
jl_toplevel_eval at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:888 [inlined]
jl_toplevel_eval_in at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:931
eval at .\boot.jl:360 [inlined]
include_string at .\loading.jl:1090
_include at .\loading.jl:1144
include at .\client.jl:444
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1703 [inlined]
do_call at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:115
eval_value at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:204
eval_stmt_value at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:155 [inlined]
eval_body at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:575
jl_interpret_toplevel_thunk at /cygdrive/c/buildbot/worker/package_win64/build/src\interpreter.c:669
jl_toplevel_eval_flex at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:879
jl_toplevel_eval_flex at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:827
jl_toplevel_eval at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:888 [inlined]
jl_toplevel_eval_in at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:931
eval at .\boot.jl:360 [inlined]
include_string at .\loading.jl:1090
_include at .\loading.jl:1144
include at .\Base.jl:386
exec_options at .\client.jl:285
_start at .\client.jl:485
jfptr__start_33914.clone_1 at C:\RRtool\julia-1.6.0-RC1\lib\julia\sys.dll (unknown line)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1703 [inlined]
true_main at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:557
repl_entrypoint at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:699
mainCRTStartup at /cygdrive/c/buildbot/worker/package_win64/build/cli\loader_exe.c:51
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 19362754 (Pool: 19359441; Big: 3313); GC: 70
C:\Users\RR\julia\BitStructs>
```
here the run with julia 1.5.3, no crash:
```
C:\Users\RR\julia\BitStructs>C:\RRtool\julia-1.5.3\bin\julia.exe test\crash.jl
Activating environment at `C:\Users\RR\julia\BitStructs\Project.toml`
S(S_RUNNING, BIGMINUS, Float16(-1.0), true, false, false, true, 0, 'a', 'c', 0x0001, 0x0002, 3, 4)BitStruct{NamedTuple{(:status, :strange, :sign, :flag1, :flag2, :flag3, :flag4, :bit1, :ac, :lc, :id1, :id2, :delta1, :delta2),Tuple{ProcStatus,Strange,Sign,Bool,Bool,Bool,Bool,BInt{1},AsciiChar,Latin1Char,BUInt{9},BUInt{12},BInt{9},BInt{9}}}} 0x0200c00802c78531
status::ProcStatus = S_RUNNING
strange::Strange = BIGMINUS
sign::Sign = -1.0
flag1::Bool = true
flag2::Bool = false
flag3::Bool = false
flag4::Bool = true
bit1::BInt{1} = 0
ac::AsciiChar = 'a'
lc::Latin1Char = 'c'
id1::BUInt{9} = 0x0000000000000001
id2::BUInt{12} = 0x0000000000000002
delta1::BInt{9} = 3
delta2::BInt{9} = 4
end
struct/BitStruct simple field access ENTER:
2.699 ns (0 allocations: 0 bytes)
397.995 ns (1 allocation: 32 bytes)
struct/BitStruct field access in @noinline function ENTER:
2.399 ns (0 allocations: 0 bytes)
364.423 ns (1 allocation: 32 bytes)
set 2 fields on struct then BitStruct ENTER:
2.399 ns (0 allocations: 0 bytes)
8.733 µs (5 allocations: 96 bytes)
set 2 fields on struct then BitStruct (large struct) ENTER:
2.399 ns (0 allocations: 0 bytes)
the statements executed by set2fields run, if executed directly
BitStruct{NamedTuple{(:status, :strange, :sign, :flag1, :flag2, :flag3, :flag4, :bit1, :ac, :lc, :id1, :id2, :delta1, :delta2),Tuple{ProcStatus,Strange,Sign,Bool,Bool,Bool,Bool,BInt{1},AsciiChar,Latin1Char,BUInt{9},BUInt{12},BInt{9},BInt{9}}}} 0x0200c00804c78511
status::ProcStatus = S_RUNNING
strange::Strange = BIGMINUS
sign::Sign = -1.0
flag1::Bool = false
flag2::Bool = false
flag3::Bool = false
flag4::Bool = true
bit1::BInt{1} = 0
ac::AsciiChar = 'a'
lc::Latin1Char = 'c'
id1::BUInt{9} = 0x0000000000000002
id2::BUInt{12} = 0x0000000000000002
delta1::BInt{9} = 3
delta2::BInt{9} = 4
end
Calling set2fields(bs) causes a crash
b1 set field in loop by /= ENTER:
2.122 µs (0 allocations: 0 bytes)
b2 set field in loop by set(..) ENTER:
2.133 µs (0 allocations: 0 bytes)
struct/BitStruct: access 4 fields in a loop ENTER:
103.389 ns (0 allocations: 0 bytes)
66.400 µs (70 allocations: 1.09 KiB)
struct/BitStruct: write 4 fields in a loop ENTER:
173.947 ns (0 allocations: 0 bytes)
struct/BitStruct: access 4 fields in a loop, large struct ENTER:
104.979 ns (0 allocations: 0 bytes)
105.200 µs (0 allocations: 0 bytes)
struct/BitStruct: write 4 fields in a loop, large struct ENTER:
175.520 ns (0 allocations: 0 bytes)
struct/BitStruct: access 4 fields, direct code ENTER:
1.799 ns (0 allocations: 0 bytes)
1.070 µs (1 allocation: 32 bytes)
function parameter benchmark: struct/BitStruct/parameterlist ENTER:
1.590 µs (17 allocations: 1.38 KiB)
1.610 µs (18 allocations: 1.39 KiB)
C:\Users\RR\julia\BitStructs>
```