Bug#890294: asymptote: complex eval-using code triggers assert failure
tags 890294 + pending thanks Added the fix to the current Debian repo for the next upload. Norbert -- PREINING Norbert http://www.preining.info Accelia Inc. +JAIST +TeX Live +Debian Developer GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13
Bug#890294: asymptote: complex eval-using code triggers assert failure
tags 890294 + fixed-upstream thanks > Hello! Following piece of code is meant to create wrapper structures > around primitive types, simplifying creation of generic code. I attach the answer of upstream - he has fixed the code to give a better error message, and also gives a way to produce a working code. Thanks Norbert -- PREINING Norbert http://www.preining.info Accelia Inc. +JAIST +TeX Live +Debian Developer GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13 --- Begin Message --- Hi Norbert, Thanks for sending on this interesting example. On my system this causes an assert. I have fixed this in commit fc0cc036f6b3733fba8b43bf5068b009fddb6bdc to generate a more informative error: /u/bowman/camp/test76.asy: 5.35: cannot convert 'real' to 'int' in assignment /u/bowman/camp/test76.asy: 6.32: cannot cast 'Aint' to 'Areal' The problem is that the quote code does not get re-evaluated with the new typedefs, but this is easy to fix with two nested evals: `void define_wrapper(string type) { string wrapper="A"+type; eval("var casts=quote {"+ "public struct "+wrapper+"{ "+type+" value; };" "typedef "+wrapper+" TWrap;"+ "typedef "+type+" TInner;"+ "public TWrap operator cast(TInner value) { var obj=new TWrap; obj.value=value; return obj; } public TInner operator cast(TWrap obj) { return obj.value; } }; eval(casts,true);",true); } define_wrapper("int"); define_wrapper("real"); Aint x; Areal y; x.value=1; y.value=pi; write(x.value); write(y.value); ` -- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/vectorgraphics/asymptote/issues/59#issuecomment-366422581--- End Message ---
Bug#890294: asymptote: complex eval-using code triggers assert failure
forwarded 890294 https://github.com/vectorgraphics/asymptote/issues/59 thanks On Wed, 14 Feb 2018, kact...@gnu.org wrote: > Yes, we definitely should send it upstream. You will do it, don't you? Done now https://github.com/vectorgraphics/asymptote/issues/59 Norbert -- PREINING Norbert http://www.preining.info Accelia Inc. +JAIST +TeX Live +Debian Developer GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13
Bug#890294: asymptote: complex eval-using code triggers assert failure
Hi! [2018-02-14 18:54] Hilmar Preuße > > Hello! Following piece of code is meant to create wrapper structures > > around primitive types, simplifying creation of generic code. > > > I simply copy any pasted your code into a file an tried to process it. > Hope this was correct. Please confirm. Yes, this is correct. > > > Unfortunately, following error is produced instead: > > > > asy: exp.cc:43: virtual void absyntax::exp::transAsType(trans::coenv&, > > types::ty*): Assertion `t->kind==ty_err > or || equivalent(t,target)' failed. > > > hille@amd64-sid:~$ asy -k asy.asy > asy: exp.cc:43: virtual void absyntax::exp::transAsType(trans::coenv&, > types::ty*): Assertion `t->kind==ty_error || equivalent(t,target)' failed. > Aborted (core dumped) Great, you see exactly the same error as I do. > I got a core dump, the back trace is attached. I guess we have to > escalate this to upstream. I did not have a look at their bug tracker > yet as sf is currently down. Yes, we definitely should send it upstream. You will do it, don't you?
Bug#890294: asymptote: complex eval-using code triggers assert failure
On 13.02.2018 05:38, kact...@gnu.org wrote: Hi, > Hello! Following piece of code is meant to create wrapper structures > around primitive types, simplifying creation of generic code. > I simply copy any pasted your code into a file an tried to process it. Hope this was correct. Please confirm. > Unfortunately, following error is produced instead: > > asy: exp.cc:43: virtual void absyntax::exp::transAsType(trans::coenv&, > types::ty*): Assertion `t->kind==ty_error || equivalent(t,target)' failed. > hille@amd64-sid:~$ asy -k asy.asy asy: exp.cc:43: virtual void absyntax::exp::transAsType(trans::coenv&, types::ty*): Assertion `t->kind==ty_error || equivalent(t,target)' failed. Aborted (core dumped) I got a core dump, the back trace is attached. I guess we have to escalate this to upstream. I did not have a look at their bug tracker yet as sf is currently down. Hilmar -- #206401 http://counter.li.org (gdb) bt #0 0x7f99a2fb16a0 in raise () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x7f99a2fb2cf7 in abort () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x7f99a2fa9fca in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x7f99a2faa042 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6 #4 0x5595e2d66ef0 in absyntax::exp::transAsType (this=0x2, e=..., target=0x5595e53bd200) at exp.cc:43 #5 0x5595e2d5bc83 in absyntax::initializeVar (pos=..., e=..., v=0x5595e4ccbc00, init=0x2) at dec.cc:462 #6 0x5595e2d5bf85 in absyntax::createVarOutOfOrder (pos=..., e=..., r=0x0, id=..., t=0x0, init=0x5595e4c5ecc0) at dec.cc:513 #7 0x5595e2d5c072 in absyntax::decid::transAsField (this=0x5595e4c5ec00, e=..., r=0x0, base=0x5595e30b91c0 ) at dec.cc:541 #8 0x5595e2d59843 in absyntax::decidlist::transAsField (this=0x2, e=..., r=0x0, base=0x5595e30b91c0 ) at dec.cc:571 #9 0x5595e2d5e5c4 in absyntax::runnable::markTrans (e=..., this=) at dec.h:149 #10 absyntax::block::trans (this=0x5595e5281b90, e=...) at dec.cc:154 #11 0x5595e2d9ced9 in absyntax::fundef::baseTrans (this=0x5595e4eec9a8, e=..., ft=0x5595e4ccbd20) at fundec.cc:254 #12 0x5595e2d5bc83 in absyntax::initializeVar (pos=..., e=..., v=0x5595e4ccbcc0, init=0x2) at dec.cc:462 #13 0x5595e2d9c7dd in absyntax::fundec::transAsField (this=0x5595e4eec980, e=..., r=0x0) at fundec.cc:315 #14 0x5595e2d5df3d in absyntax::modifiedRunnable::transAsField (this=0x5595e4c5edc0, e=..., r=0x0) at dec.cc:328 #15 0x5595e2d5e5c4 in absyntax::runnable::markTrans (e=..., this=) at dec.h:149 #16 absyntax::block::trans (this=0x5595e5281c80, e=...) at dec.cc:154 #17 0x5595e2d5b334 in absyntax::runnable::markTrans (e=..., this=) at dec.h:149 #18 absyntax::runnable::transAsCodelet (this=0x5595e5281c80, e=...) at dec.cc:133 #19 0x5595e2da603f in runRunnable (r=0x5595e5281c80, e=..., s=..., tm=TRANS_NORMAL) at process.cc:162 #20 0x5595e2dac38a in itree::run (this=0x5595e4c57920, e=..., s=..., tm=TRANS_NORMAL) at process.cc:311 #21 0x5595e2da72da in runCodeEmbedded (code=0x5595e5285280, e=..., s=...) at process.cc:897 #22 0x5595e2d752a7 in vm::stack::runWithOrWithoutClosure (this=0x2, l=0xd, vars=0x0, parent=0x5595e53cbc88) at stack.cc:455 #23 0x5595e2d751ae in vm::stack::runWithOrWithoutClosure (this=0x2, l=0x30, vars=0x0, parent=0x5595e4c79780) at stack.cc:513 #24 0x5595e2d751ae in vm::stack::runWithOrWithoutClosure (this=0x2, l=0x2, vars=0x0, parent=0x5595e54cf890) at stack.cc:513 #25 0x5595e2da60b0 in runRunnable (r=0x5595e53861e0, e=..., s=..., tm=TRANS_INTERACTIVE) at process.cc:168 #26 0x5595e2dac38a in itree::run (this=0x5595e53ff140, e=..., s=..., tm=TRANS_NORMAL) at process.cc:311 #27 0x5595e2dab6c0 in icore::doRun (this=0x2, purge=80, tm=TRANS_INTERACTIVE) at process.cc:234 #28 0x5595e2da400d in icore::process (purge=, this=) at process.cc:257 #29 ifile::process (purge=, this=) at process.cc:396 #30 processFile (filename=, purge=80) at process.cc:877 #31 0x5595e2deece0 in asymain (A=0x2) at main.cc:135 #32 0x5595e2b5c9d7 in main (argc=2, argv=0x7ffc064a5b70) at main.cc:215 (gdb) signature.asc Description: OpenPGP digital signature
Bug#890294: asymptote: complex eval-using code triggers assert failure
Package: asymptote Version: 2.41-4 Severity: normal Hello! Following piece of code is meant to create wrapper structures around primitive types, simplifying creation of generic code. var casts = quote { public TWrap operator cast(TInner value) { var obj = new TWrap; obj.value = value; return obj; } public TInner operator cast(TWrap obj) { return obj.value; } }; void define_wrapper(string type) { string wrapper = 'A' + type; string prog = 'public struct ' + wrapper + '{ ' + type + ' value; };'; eval(prog, true); eval('typedef ' + wrapper + ' TWrap', true); eval('typedef ' + type + ' TInner', true); eval(casts, true); } define_wrapper('int'); define_wrapper('real'); Unfortunately, following error is produced instead: asy: exp.cc:43: virtual void absyntax::exp::transAsType(trans::coenv&, types::ty*): Assertion `t->kind==ty_error || equivalent(t,target)' failed. Problem is present in both versions in sid and stretch.