pcbasic icon indicating copy to clipboard operation
pcbasic copied to clipboard

Calculating PI with Nilakantha formula. *Bug*

Open Ronald-Herrera opened this issue 6 months ago • 2 comments

A blue screen occur with the attachment sent.

crash-20250629-q1ukok84.log

Ronald-Herrera avatar Jun 29 '25 20:06 Ronald-Herrera

I can confirm this issue.

The error is dereferencing a string at address &H1697 which isn't there anymore. That address is very close to the end of the program (&H1653) and there is a string at &HFDCB that's not bound to a variable name, so I guess what happened was that string is the first argument of MID$(), then the creation of the string involved in the third arguments expression triggered a garbage collection that moved the string data of the first argument from &H1697 to &HFDCB but the code still tries to access it at the old address.

That seems to be a bug in PC-BASIC because the programs runs without those problems in GW-BASIC.

Marrin avatar Jul 19 '25 12:07 Marrin

Thank you! Happy to help and test.

Ron.


From: Marc Rintsch @.> Sent: Saturday, July 19, 2025 8:27 AM To: robhagemans/pcbasic @.> Cc: Ronald-Herrera @.>; Author @.> Subject: Re: [robhagemans/pcbasic] Calculating PI with Nilakantha formula. Bug (Issue #251)

[https://avatars.githubusercontent.com/u/2564163?s=20&v=4]Marrin left a comment (robhagemans/pcbasic#251)https://github.com/robhagemans/pcbasic/issues/251#issuecomment-3092325134

I can confirm this issue.

The error is dereferencing a string at address &H1697 which isn't there anymore. That address is very close to the end of the program (&H1653) and there is a string at &HFDCB that's not bound to a variable name, so I guess what happened was that string is the first argument of MID$(), then the creation of the string involved in the third arguments expression triggered a garbage collection that moved the string data of the first argument from &H1697 to &HFDCB but the code still tries to access it at the old address.

That seems to be a bug in PC-BASIC because the programs runs without those problems in GW-BASIC.

— Reply to this email directly, view it on GitHubhttps://github.com/robhagemans/pcbasic/issues/251#issuecomment-3092325134, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BUDDMALLOS6EQAFI7KA32C33JI2TDAVCNFSM6AAAAACAMTDJ7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAOJSGMZDKMJTGQ. You are receiving this because you authored the thread.Message ID: @.***>

Ronald-Herrera avatar Aug 03 '25 03:08 Ronald-Herrera