At 9:39 AM -0400 5/23/02, Clinton A. Pierce wrote: >[re-cc'd p6i due to mailer failure on my part] >>At 10:17 PM 5/22/2002 +0000, via RT wrote: >>Clinton A. Pierce wrote: >> >>> * sync up, and get the latest Parrot BASIC. It's fully hash-enabled and >>> quite speedy now. >>> >>> * Run "basic.pl" to assemble the interpreter, and get it started >>> >>> * At the "Ready" prompt, "LOAD eliza" >>> >>> * When finished, type RUN >>> >>> The crash will happen shortly thereafter. Comments in #parrot seem to >> >>The problem appears to originate in the routine SFETCH, which tries to fetch >>key "TWIRL" from the hash in P21 without finding it. The hash code returns a >>null pointer under these circumstances, which is accepted as an empty string >>by some, but not all, string handling code. In this case, attempting to >>store the string into an array is invoking string_copy, which assumes the >>input to be valid. IIRC Dan stated some time ago that checks for null were >>not to be included, but I don't know what the current status is. > >A patch to add isnull was submitted today, which is one potential >way of handling it. Another is to not have get_keyed return the >NULL in the first place. I favor the latter, because there's no >other way that I'm aware of in PASM to get an Sx register with a >NULL in it, why start introducing this now? It seems unclean. > >(But a patch oftentimes speaks louder than opinions.)
Having the potential to check seems reasonable at least for sub entry/exit, for the safe mode interpreter at the very least. Or folks writing hand-coded assembly that don't have the potential for automatic correctness. (Assuming a correct compiler, of course) >So temporarily I patched basicvar.pasm so that instead of: You can unpatch now. I fixed the problem, which was that perlundef returns NULL rather than an empty string. Still need to fix the problem of it returning NULL rather than an empty PMC, but that's next. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk