<cepheus>
doesn't UD2 get generated for unreachable branched by LLVM?
<cepheus>
* doesn't UD2 get generated for unreachable branches by LLVM?
<g-w1>
yes, thats what i thuoght, but this seems to be in allocator.dupe
cole-h has joined #zig
<mikdusan>
g-w1: while tracking down the first bug, I noticed some really odd behavior stepping through code in getContainer()
<mikdusan>
it stepped, then the correct if body got stepped,
<mikdusan>
then it went backwards and repeated something
<mikdusan>
_that_ kinda smelled like bad codegen
<g-w1>
hmm and it does not fail in releasefast mode
<g-w1>
only in it *only* fails on releasesafe, not debug or releasefast
<g-w1>
removing that call to dupe fixes it. it was trying to dupe bad memory since it was undefined
<g-w1>
i think the bug is in std.mem.copy
<g-w1>
pub fn copy(comptime T: type, dest: []T, source: []const T) void {// TODO instead of manually doing this check for the whole array // and turning off runtime safety, the compiler should detect loops like // this and automatically omit safety checks for loops @setRuntimeSafety(false); assert(dest.len >= source.len); for (source) |s, i| dest[i] = s;} <- i think the assert should be before the setRuntimeSafety, not after it
<g-w1>
hmm moving the assert up does not fix it.
<g-w1>
i figured out my immediate bug, so thanks, but this should be looked into ig. do you want me to close the issue, or keep it open and explain what i think is going wrong?
<g-w1>
oh nice, you made a repro :)
<mikdusan>
heh I tried the 1 liner and it reduced :)
<cepheus>
this can apparently also happen if you do the same thing with optionals and orelse
<mikdusan>
g-w1: so that was a nice one. two distinct (and I think) independent bugs
<g-w1>
yep, thanks so much.
<g-w1>
i did not know that llvm could insert illegal instruction
<mikdusan>
tbh I am getting more and more surprised at these things that llvm (and clang) are doing with "ub license"
RadekCh has quit [Quit: Connection closed]
<mikdusan>
if I grok, we are opting into this sanitizer. but illegal instruction? don't we have the technology to emit text error messages ? :)
<g-w1>
on the bright side, my doc generator backend is basically done, now i just gotta do some webdev and hopefully replace the auto-generated docs :) heres a prototype: https://i.imgur.com/3CsfWZ2.png
<mikdusan>
ah that's what you're up to
<g-w1>
yep, thats why i had all that ast code
neptunepink has quit [Ping timeout: 240 seconds]
dongcarl has joined #zig
neptunepink has joined #zig
astronavt has quit [Remote host closed the connection]
FireFox317 has joined #zig
<FireFox317>
I think the zir-memory-layout branch is almost ready to be merged right? I looked into memory leaking of the of the LLVM backend and we are not leaking anything :D
<andrewrk>
FireFox317, yep it is very close, the last big remaining item is switch expressions
<andrewrk>
then it's just cleanup
<Nypsie>
Great work guys!
<FireFox317>
ah great!
<g-w1>
awesome!
<andrewrk>
oh also as a bonus, this branch comes with a nice PoC of inline while, at least the control flow aspect of it (we still need to solve comptime locals)
<FireFox317>
another bonus, this branch comes with a rework of the LLVM backend :D
<g-w1>
ok, time to learn about search techniques :)
yyp has joined #zig
<andrewrk>
g-w1, are you a student? it's fun watching you get excited and learn about all this different stuff
Akuli has joined #zig
<g-w1>
i am a student, but not for computer science, i have learned computer science by myself
<FireFox317>
g-w1, what do you study?
<g-w1>
i haven't decided yet :P
<FireFox317>
ah interesting :P
andreao6 has joined #zig
andreao has quit [Ping timeout: 240 seconds]
andreao6 is now known as andreao
lunamn has quit [Quit: Ping timeout (120 seconds)]
lunamn has joined #zig
nvmd has joined #zig
andreao3 has joined #zig
andreao has quit [Ping timeout: 246 seconds]
andreao3 is now known as andreao
andreao1 has joined #zig
andreao has quit [Ping timeout: 240 seconds]
andreao1 has quit [Ping timeout: 246 seconds]
FireFox317 has quit [Ping timeout: 240 seconds]
frett27 has joined #zig
FireFox317 has joined #zig
<cepheus>
aww, enumerating decls is a really useful way to force doc building for an entire module, but naturally it doesn't work in modules where @compileError is used to denote deprected functions
spacelove has joined #zig
<cepheus>
hmm, it did also pick up a bit of bitrot in the standard library too by the looks
spacelove has quit [Client Quit]
sundbp has quit [Ping timeout: 260 seconds]
tnorth has quit [Ping timeout: 252 seconds]
wilsonk__ has joined #zig
wilsonk has quit [Ping timeout: 265 seconds]
FireFox317 has quit [Ping timeout: 260 seconds]
ur5us__ has joined #zig
klltkr has joined #zig
kenran has joined #zig
Akuli has quit [Quit: Leaving]
mokafolio has quit [Read error: Connection reset by peer]
sord937 has quit [Quit: sord937]
Snaffu has quit [Ping timeout: 265 seconds]
frett27 has quit [Ping timeout: 246 seconds]
yyp has quit [Quit: now it's safe to turn off your computer]
kenran has quit [Quit: leaving]
dimenus has quit [Ping timeout: 265 seconds]
LewisGaul has joined #zig
<LewisGaul>
Hey, I'm having some problems adding a package dependency, I haven't managed to get `exe.addPackagePath()` working. Would anyone be able to take a look to see if there's anything obvious I'm doing wrong?
<LewisGaul>
Never mind, the problem seems to be with the run command depending on both the exe and the lib install, where only the exe depends on the package... not sure if this might be considered a subtle bug so will raise an issue in case
spacelove has joined #zig
<spacelove>
Found some interesting behavior when trying to make a copy of an array: https://zigbin.io/cc3532
<spacelove>
Seems like this shouldn't work, but it does
<andrewrk>
cepheus, neat, do you have a fork where you improved the doc gen stuff?
<cepheus>
this is all acutally just using the limited markdown support that exists in the current zig compiler, aha
<cepheus>
I'm sure it would be possible to do stuff like auto cross-linking as a feature of doc gen though
<andrewrk>
yeah I think there is even an issue open for that already
<andrewrk>
I'm thinking about having auto generated documentation operate mainly based on the AST, but then potentially being augmented by types and values from semantic analysis
<andrewrk>
right now it's only the output from semantic analysis, which leaves out anything that did not get referenced
<cepheus>
as i alluded to earlier i worked around that somewhat by doing a very nasty hack of generating the docs through a fake test harness which just iterates over the module's struct decls
LewisGaul has joined #zig
<cepheus>
that actually showed some promise in detecting a couple of compile issues with untested bits of std which i might investigate at some point
scoop018 has quit [Quit: This computer has gone to sleep]
krux02 has joined #zig
<krux02>
hello people, just new to zig and try out how it works.
<LewisGaul>
good question, I'm not familiar with packed structs in zig, maybe someone else can help
<krux02>
it looks to me like a bug.
<krux02>
until 8 bool values, the struct has 9 bytes.
<krux02>
With the 9th bool field, the struct suddenly increases to size 9+8=17
<mikdusan>
packed structs will improve with self-hosted compiler which is under heavy development right now. The current stage1 compiler support for packed structs has bugs and many issues are open against it
<krux02>
ok, good to know.
<andrewrk>
I get a security certificate failure when I try to look at the code
<krux02>
why security certificate failure?
<andrewrk>
with http my ISP performs a man-in-the-middle attack on me
<krux02>
you have problems with ix.io, or is your ide telling you something about my code?
<andrewrk>
so I tried https but it has an invalid certificate
<krux02>
yea there is no https
<krux02>
it is just http
<krux02>
non encrypted raw text
<krux02>
you can get it with curl
<andrewrk>
krux02, there is a compiler bug with packed structs whose bits do not add up to a byte boundary
<krux02>
I also looked at normal structs.
<krux02>
As the specification says, it might reorder the fields.
dingenskirchen has quit [Quit: ZNC 1.8.1 - https://znc.in]
<krux02>
Then I created a struct where a simple reorder would significantly reduce the size and it didn't happen.
<andrewrk>
not implemented
<krux02>
The struct was still as if it would be a C struct?
dingenskirchen has joined #zig
<krux02>
Is this just a placeholder for the future to reorder fields one day in the future?
<andrewrk>
yes, it's important to make sure to reserve the right to do this early, otherwise people might write code that relies on something that will change
<g-w1>
hopefully it will get fixed in the next year :)
<krux02>
apart from my concern that these "optimizations" are even a good idea, letting issues open for 5 years open for core features of the language like struct is a bit unsettling.
<andrewrk>
well why didn't you fix it yet then?
<krux02>
I've used the language for about 10 minutes and already hit a compiler bug.
<mikdusan>
what I like is these features have been thought about already, are recorded, tracked, and factored as development progresses
<andrewrk>
come back after 1.0 if you want to not hit bugs
<krux02>
andrewrk, yea probably will do that.
earnestly has quit [Ping timeout: 240 seconds]
<krux02>
Don't take it personal, I got recently burned by a language that had too many bugs. Can't afford to do it again.
<krux02>
Thanks for the help.
<mikdusan>
I'm having one of those zero-attention span days. Can't focus on anything :(
<andrewrk>
sometimes I have those days. my strategy is to close all applications except editor, and put my phone in another room
<mikdusan>
ah yeah I heard you mention doing that just recently
<g-w1>
is there an equavalent of mkdir -p in zig stdlib?
<mikdusan>
makePath ?
<andrewrk>
see also makeOpenPath
<g-w1>
thanks
<andrewrk>
surprisingly windows wins the syscall contest on this one, you can do makeOpenPath in 1 syscall on windows
<g-w1>
it seems like the impl doesn't do that though? it just loops through all the sub-paths
<andrewrk>
all os's have to do that, but nt lets you create a dir and open it at the same time
<g-w1>
ohh i see
<mikdusan>
I remember being absolutely blown away by subdirs. Apple DOS never had them then came ProDos which added subdirs. and in the meantime cp/m had them (iirc)
earnestly has joined #zig
spacelove has quit [Quit: Connection closed]
LewisGaul has quit [Ping timeout: 240 seconds]
krux02 has quit [Remote host closed the connection]