Conversation
NewExpr::link left a NEW whose type was neither an array, a host class with a constructor, nor a script class, and both paths then dereferenced the null cppiaClass: runObject when the line ran, and genCode while the JIT compiled the module. It now reports "Could not link new" and throws "Bad link", as the other link failures do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
It would be good to turn the sample into a minimal test case that can fix cleanly into the existing cppia tests |
ClientUnlinked constructs an extern class, which the cppia module only names. Loading it must fail to link: before the fix, the JIT segfaulted while compiling the module, and without the JIT the load succeeded and left a null class to construct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Done in 7d2d8cc: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A cppia
NEWnaming a class the host does not have ends the process instead of failing to link.NewExpr::linkpicks how to construct: an array type, a host class'smConstructArgs, or the script class (type->cppiaClass). When none of the three exists it carries on, and then:runObjectcallstype->cppiaClass->createInstanceon a null pointer when the line runs;genCodereadstype->cppiaClasswhile compiling the module, so loading it crashes.A script built against another version of a host reaches this, as does a generator that names a type with no runtime class (an abstract, for instance). The other link failures report and throw
"Bad link"(Could not link static ...,Could not link %s::%s), whichLoadCppiaturns into an error the host can catch.NewExpr::linknow does the same when it has nothing to construct.Repro (host, two ASCII cppia scripts that differ only in the class name): hxcpp-cppia-new-unlinked-class.zip.
With
master,new Missing()segfaults with and without the JIT; with the fix, both printCould not link new Missingand the load throwsBad link, while the script constructing a host class still runs.test/cppia(CppiaHost, with and without-jit): ALL TESTS OK, 15/15 in both.