beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
z4k4ri4 has quit [Quit: WeeChat 3.6]
theruran has quit [Quit: Connection closed for inactivity]
<abu[7]> I changed to -O1 for now
z4k4ri4 has joined #picolisp
<abu[7]> Comparing the generated src/picolisp.s files for -O1 and -O2
<tankf33der> Please note that the optimization "broke" as soon as you started handling the coroutines.
<abu[7]> Yes
<tankf33der> and i did not noticed -O2 issue on my debian
<abu[7]> But with -O2 it breaks immedately
<abu[7]> llvm16 for me
<abu[7]> me
<tankf33der> llvm11 on my debian
<abu[7]> I think it has to do with setting the stack pointer
<abu[7]> C programs don't do that
<tankf33der> playing with llvm16 on freebsd
<abu[7]> Just calu
<abu[7]> (co 'a (yield 1) 2)
<abu[7]> twice
<abu[7]> It crashes on returning at the end
<tankf33der> O
<tankf33der> crashed
<tankf33der> super
<tankf33der> i have a sandbox now
<abu[7]> The stack pointer is wrong
<tankf33der> is it llvm16 only issue ?
<abu[7]> I don't know, I have 3 Debian machines all with 16
<tankf33der> i see the same speed on -O1 and -O2 here:
<abu[7]> I use the same, here 1.2 -> 1.6 sec
<abu[7]> O2 -> O1
<tankf33der> afk
<abu[7]> Seems you are right and it is not the optimizer
<tankf33der> I have a debian with all llvm range versions installed on work
<abu[7]> I try to debug more
<tankf33der> i can get the same at home
<tankf33der> reinstalling laptop
<abu[7]> ok
<abu[7]> When inserting dbg calls, I can crash also with -O1
<tankf33der> i have got linux llvm16 crash with -O2
<abu[7]> ok
<tankf33der> i have got three llvm env 14,16,17
<abu[7]> on Debian?
<tankf33der> archlinux-manjaro
<tankf33der> modern glibc distro
<abu[7]> x86
<tankf33der> 64
<abu[7]> On Termux it is arm64
<tankf33der> ok
<abu[7]> always ok on Termux
<tankf33der> do not guard stack
<tankf33der> maybe some stack protection enabled in debian by default
<tankf33der> to protect system from bad coders
<abu[7]> I can see that a value in the stack gets overwritten
<tankf33der> i see
<tankf33der> afk
<abu[7]> o/
<tankf33der> I will play with strong stack protection later
<abu[7]> Good!
<tankf33der> This one
<abu[7]> ok
<tankf33der> It worked many years ago
<abu[7]> T
<tankf33der> compiled
<tankf33der> running
<tankf33der> -fstack-protector-strong default llvm - passed
<abu[7]> ok
<abu[7]> A local var in 'a's stack frame gets overwritten
<tankf33der> -fstack-protector-all default llvm - passed
<abu[7]> hmm
<abu[7]> I still try to find the place that does this
<tankf33der> pil21 does not work under address sanitizer now
<tankf33der> worked a week ago
<abu[7]> Interesting! A hint?
<tankf33der> pil + - crashed
<tankf33der> pil - ok
<abu[7]> All heisenbug behavior
<abu[7]> I now found a way to trace that variable, can now try to find the bad place
<abu[7]> Strange, the memory location does not change
<abu[7]> but the var does
<abu[7]> so the frame register ...
<tankf33der> interesting
<abu[7]> movq -48(%rbp), ...
<abu[7]> so %rbp must have changed (?)
<abu[7]> can't be
<tankf33der> under -O2 ?
<abu[7]> T
<tankf33der> -O1 -O3 /
<tankf33der> -O1 -O3 ?
<abu[7]> but -O1 also crashes
<tankf33der> -O0 ?
<tankf33der> ASAN error on some co code
<tankf33der> must i find which ?
<abu[7]> Checking
<abu[7]> What is ASan?
<tankf33der> address sanitizer
<abu[7]> ok
<abu[7]> I don't know what shadow mem is
<tankf33der> me too
<abu[7]> It must be that I do something illegal around setjmp/longjmp
<abu[7]> Perhaps I forgot some rule
<tankf33der> your rules ?
<abu[7]> No, longjmp
<abu[7]> Some locals may not be preserved
<abu[7]> Let me check
<abu[7]> Reading the man pages again
<abu[7]> "CAVEATS"
<abu[7]> "The compiler may optimize variables into registers, and longjmp() may restore the values of other registers in addition to the stack pointer and program counter."
<abu[7]> I fogot that
<abu[7]> perhaps violated somewhere
<abu[7]> I check all places
<tankf33der> sounds like this
<abu[7]> T
<tankf33der> and -O3 will be back :)
<abu[7]> Hmm ...
<abu[7]> .
<tankf33der> afk
<abu[7]> cu
beneroth_ has joined #picolisp
beneroth has quit [Read error: Connection reset by peer]
<tankf33der> abu[7]: any updates?
<abu[7]> No
<abu[7]> I don't find a way to guarantee the survival of the vars
<tankf33der> i see
<abu[7]> Perhaps need do make them "votile", but this requires a major extension of @src/lib/llvm.l
<abu[7]> What did you find? Is it at least the case that it works everywhere with -O1 h
<abu[7]> ?
<tankf33der> i did play with some settings but no results
<abu[7]> ok
<abu[7]> I'll dig deeper
<tankf33der> how it worked many years before >
<tankf33der> ?
<abu[7]> I think by lucky coincidence
<abu[7]> Variables usage patterns
<tankf33der> lucky is over, yeah
<abu[7]> I try to understand it myself ;)
<abu[7]> If I put (dbg .. var .. it often works
<abu[7]> or even crashes better
<abu[7]> Must take a walk and meditate
<abu[7]> Too hot now though
<tankf33der> ok
<abu[7]> At the moment I don't even know *which* variable(s) are destroyed (if it is indeed so), because printing them changes the situation
<abu[7]> Also, technically I have no case where a var really violates the conditions described in CAVEATS in the man page of setjmp/longjmp
<abu[7]> So it is possible that I simply have a typo in the source somewhere
<tankf33der> hm
<abu[7]> 'lint' would find that, but it's hard to use it in the build context
<abu[7]> I dig more :)
<tankf33der> :)
<abu[7]> I begin to understand my own mess
beneroth_ has quit [Quit: Leaving]
beneroth has joined #picolisp
<tankf33der> Back
<abu[7]> Nothing new on my side yet :(