spitbol / x64

SPITBOL x64 provides raw power and speed for non-numeric computation on the x86_64 architecture
GNU General Public License v3.0
256 stars 23 forks source link

Ubuntu 18.04 problem with running float.sbl causing overflow or underflow #14

Closed osmanfb closed 2 years ago

osmanfb commented 2 years ago

I built the x64 spitbol on my ubuntu 18.04 laptop. Building and running sanitychecjk went ok and I installed it. But trying it on the files in the test subdirectory, I am having a problem with float.sbl file. ../sbl float.sbl

  1. expect 5.0

test/float_orig.sbl(9) : error 264 -- subtraction caused real overflow

in file test/float_orig.sbl in line 9 in statement 9 stmts executed 9 execution time msec 0 in line 0 memory used (bytes) 12792 memory left (bytes) 249344

same thing happens with the spitbol executable from the bin subdir.. But if build the 32 bit version from github/x32 then that spitbol runs the float.sbl without any problems. Also if switch floats to integers, it also works. What could be the problem/where to look ??? TIA

CheyenneWills commented 2 years ago

I'm also running into a similar problem, but am getting a segfault around label gts26 with just a simple:

x = 2.0 'a' end

CheyenneWills commented 2 years ago

I think I might know what is going on and I'm investigating a solution (possible misplacement of a read-write area into a read only segment)

CheyenneWills commented 2 years ago

Found the problem and have a fix. It wasn't what I had thought above.

Some of the internal calls to C functions from the assembly code need to preserve some registers that get clobbered (I believe that this might be a Linux vs Windows difference).

Adding a couple of pushes prior to the calls and pops afterwards appears to fix the problem.

CheyenneWills commented 2 years ago

Pull Request #15 I believe fixes the problem. The branch contains some of the other patches that I've worked on and includes some general (and minor) build cleanup.

osmanfb commented 2 years ago

Thanks for looking into and fixing but how long does it take github to update the master branch? I just cloned the master into a new folder and float.sbl still causing the underflow.

CheyenneWills commented 2 years ago

Thanks for looking into and fixing but how long does it take github to update the master branch? I just cloned the master into a new folder and float.sbl still causing the underflow.

I'm waiting to hear back from Dave Shields who has commit authority. In the meantime you can use what's in the above pull request.

osmanfb commented 2 years ago

I did. I changed sbl.asm, int.asm, int.dcl as the diffs showed. same problem. looks like clobbering happens on the output = statements, Variable calculations of any complexity that I tried worked ok as long as the output statement did not contain any float ops. I also cloned bootstrap and it did not work either. Looks like the above asm and dcl files are created each time make is executed. So the changes are overwritten. Since I don't know what I'm doing, I'll wait until master is updated.

daveshields commented 2 years ago

Cheyenne,

Thanks for all your work. I reviewed your prior emails and noted that I invited to to become a committer on November 4, so please feel free to pull your patches into the master.

thanks, dave

On Wed, Dec 29, 2021 at 12:49 PM osmanfb @.***> wrote:

I did. I changed sbl.asm, int.asm, int.dcl as the diffs showed. same problem. looks like clobbering happens on the output = statements, Variable calculations of any complexity that I tried worked ok as long as the output statement did not contain any float ops. I also cloned bootstrap and it did not work either. Looks like the above asm and dcl files are created each time make is executed. So the changes are overwritten.

— Reply to this email directly, view it on GitHub https://github.com/spitbol/x64/issues/14#issuecomment-1002708618, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARPPNSMSPAM5H2EONPKX3UTNC3NANCNFSM5KTYG3AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

CheyenneWills commented 2 years ago

Cheyenne, Thanks for all your work. I reviewed your prior emails and noted that I invited to to become a committer on November 4, so please feel free to pull your patches into the master. thanks, dave

Thanks Dave. It appears that I don't have write access to the spitbol/x64 repository, just read access so I can't complete the pull request.

daveshields commented 2 years ago

Cheyenne,

Right you are. Sorry about that.

I just changed your role to Owner. I think that should do it.

dave

On Sun, Jan 2, 2022 at 9:50 AM Cheyenne Wills @.***> wrote:

Cheyenne, Thanks for all your work. I reviewed your prior emails and noted that I invited to to become a committer on November 4, so please feel free to pull your patches into the master. thanks, dave

Thanks Dave. It appears that I don't have write access to the spitbol/x64 repository, just read access so I can't complete the pull request.

— Reply to this email directly, view it on GitHub https://github.com/spitbol/x64/issues/14#issuecomment-1003727373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARPPIRAYIG7A624TGDJE3UUBQ4VANCNFSM5KTYG3AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

CheyenneWills commented 2 years ago

The fix is now in master.

CheyenneWills commented 2 years ago

::sigh:: still a minor problem (probably a missed call).

daveshields commented 2 years ago

FYI,

sanity-check doesn't test or require any floating point arithmetic, since SPITBOL can be configured to not support floating point arithmetic. It just checks that the system is capable of rebuilding itself, and that the rebuilt system can also rebuild itself. All this is to make sure some nasty bug doesn't creep in only to show up later.

thanks, dave

On Mon, Jan 3, 2022 at 12:36 PM Cheyenne Wills @.***> wrote:

::sigh:: still a minor problem (probably a missed call).

— Reply to this email directly, view it on GitHub https://github.com/spitbol/x64/issues/14#issuecomment-1004247310, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARPPPTXOL4MURBNUKWVFLUUHNBFANCNFSM5KTYG3AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

CheyenneWills commented 2 years ago

I found the problem with the floating point. There needed to be some checks for floating point "problems" with some of the operations (+-/*). I have a "fix" for that as well..

New PR coming in for that..

CheyenneWills commented 2 years ago

PR #16 should better handle the problem with some floating point operations.

I was getting the error: "test/float.sbl(9) : error 264 -- subtraction caused real overflow". The above PR should fix that.

osmanfb commented 2 years ago

as of Jan 04, 2 pm the master branch still causing the floating point exception. I checked that having bunch of lines of float operations does not cause the exception. But multiple "output = " with floats does. x = 2.0 y = 5.0 z = x + y ( y - 1.0) w = x y * z output = w output = x output = x + y end the last output cause an exception. If taken out runs ok.

CheyenneWills commented 2 years ago

as of Jan 04, 2 pm the master branch still causing the floating point exception. I checked that having bunch of lines of float operations does not cause the exception. But multiple "output = " with floats does. x = 2.0 y = 5.0 z = x + y ( y - 1.0) w = x y * z output = w output = x output = x + y end the last output cause an exception. If taken out runs ok.

I've merged the latest changes (PR #16) into master.

osmanfb commented 2 years ago

thanks Cheyenne. master is working ok now (Jan 6, 00:28). The only thing is the pre-built bin/sbl is causing "illegal instruction" and maybe should not be included. Also a few lines could be added to the README to do a make bootsbl first and then follow with make BASEBOL=./bootsbl and finally make bininst to copy the sbl to the bin directory.