StanzaOrg / lbstanza-old

L.B. Stanza Programming Language
Other
216 stars 23 forks source link

ptr to ptr causes build failure #182

Closed callendorph closed 1 year ago

callendorph commented 1 year ago

Hi - while attempting to write a wrapper for libcairo - I ran into an issue when attempting to use a pointer to a pointer (ptr<ptr<?>>) in lostanza.

Here is a repeatable test case:

ptrtoptr_testcase.zip

When I attempt to build this - I get

$ stanza build                    
FATAL ERROR: Illegal tag bits                                                                                                                                                                                                                     in core/print-stack-trace                                                                                                 at core/core.stanza:332.14                                                                                            in core/fatal                                                                                                             at core/core.stanza:385.2                                                                                             in core/fatal                                                                                                             at core/core.stanza:389.9                                                                                             in core/object-type                                                                                                       at core/core.stanza:3852.25                                                                                           in core/seq                                                                                                               at core/core.stanza:8399.15                                                                                           in core/repeat-while                                                                                                      at core/core.stanza:8906.25                                                                                           in core/wrap-length                                                                                                       at core/core.stanza:8388.30                                                                                           in core/join                                                                                                              at core/core.stanza:8823.6                                                                                            in core/wrap-length                                                                                                       at core/core.stanza:8388.30                                                                                           in core/do                                                                                                                at core/core.stanza:8331.16                                                                                           in core/do                                                                                                                at core/core.stanza:8330.20                                                                                           in core/print-all                                                                                                         at core/core.stanza:4362.3                                                                                            in core/modulo                                                                                                            at core/core.stanza:6563.22                                                                                           in core/to-string                                                                                                         at core/core.stanza:3963.3                                                                                            in core/fatal                                                                                                             at core/core.stanza:385.16                                                                                            in core/no-branch-error                                                                                                   at core/core.stanza:262.2                                                                                             in stz/el-to-vm/Compiler                                                                                                  at compiler/el-to-vm.stanza:621.10                                                                                    in stz/el-to-vm/Compiler                                                                                                  at compiler/el-to-vm.stanza:631.13                                                                                    in stz/el-to-vm/Compiler                                                                                                  at compiler/el-to-vm.stanza:1020.38                                                                                   in core/do                                                                                                                at core/core.stanza:8359.9                                                                                            in stz/el-to-vm/Compiler                                                                                                  at compiler/el-to-vm.stanza:1352.6                                                                                    in stz/el-to-vm/compile-efunction                                                                                         at compiler/el-to-vm.stanza:368.6                                                                                     in stz/el-to-vm/compile                                                                                                   at compiler/el-to-vm.stanza:187.18                                                                                    in core/do                                                                                                                at core/core.stanza:8359.9                                                                                            in stz/utils/time-ms!                                                                                                     at compiler/utils.stanza:322.15                                                                                       in stz/timing-log-api/log-time                                                                                            at compiler/timing-log-api.stanza:162.4                                                                               in stz/timing-log-api/log-time                                                                                            at compiler/timing-log-api.stanza:142.2                                                                               in stz/compiler-main/compile                                                                                              at compiler/compiler-main.stanza:295.22                                                                               in core/do                                                                                                                at core/core.stanza:8359.9                                                                                            in stz/compiler-main/compile                                                                                              at compiler/compiler-main.stanza:231.6                                                                                in stz/compiler-main/compile                                                                                              at compiler/compiler-main.stanza:209.22                                                                               in stz/compiler/compile                                                                                                   at compiler/compiler.stanza:198.24                                                                                    in stz/main/build-command                                                                                                 at compiler/main.stanza:321.8                                                                                         in stz/main/run-with-verbose-flag                                                                                         at compiler/main.stanza:73.4                                                                                          in stz/main/build-command                                                                                                 at compiler/main.stanza:320.13                                                                                        in stz/main/run-with-timing-log                                                                                           at compiler/main.stanza:61.4                                                                                          in stz/main/build-command                                                                                                 at compiler/main.stanza:319.11                                                                                        in stz/main/intercept-no-match-exceptions                                                                                 at compiler/main.stanza:1066.6                                                                                        in core/with-exception-handler                                                                                            at core/core.stanza:5918.19                                                                                           in core/setup-coroutine                                                                                                   at core/core.stanza:3570.20                                                                                           in core/with-exception-handler                                                                                            at core/core.stanza:5899.16                                                                                           in stz/main/intercept-no-match-exceptions                                                                                 at compiler/main.stanza:1066.6                                                                                        in arg-parser/execute                                                                                                     at core/arg-parser.stanza:486.2                                                                                       in core/with-exception-handler                                                                                            at core/core.stanza:5918.19                                                                                           in core/setup-coroutine                                                                                                   at core/core.stanza:3570.20                                                                                           in core/with-exception-handler                                                                                            at core/core.stanza:5899.16                                                                                           in arg-parser/simple-command-line-cli                                                                                     at core/arg-parser.stanza:510.8                                                                                       in arg-parser/simple-command-line-cli                                                                                     at core/arg-parser.stanza:496.2                                                                                       in stz/main/stanza-main                                                                                                   at compiler/main.stanza:1107.2                           

More readable traceback here:

https://gist.github.com/callendorph/75486059c6d71d603b01d894caee70dc

I've tried with addr instead of addr! as well and get the same result.

I can't replicate it here in this test case - but in my other project - I will randomly get other messages as well. Some times it will seg fault.

FATAL ERROR: No appropriate branch for arguments of type (Commit).
...
FATAL ERROR: No appropriate branch for arguments of type (Int).
...

Thoughts ?

Edit:

Stanza Version 0.17.40.

callendorph commented 1 year ago

Perhaps this is the same issue as https://github.com/StanzaOrg/lbstanza/issues/173

callendorph commented 1 year ago

Ya - that must be the problem. NVM