Author Topic: Crash with STR  (Read 2243 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
Crash with STR
« on: November 15, 2018, 06:30:53 AM »

This code is crashing when i add a second parameter. I suspect is is because of recursion, how can i fix this? how can i make sure it calls system str instead of calling the function itself?

Code: [Select]
' Enter the stock code and functions here.
FUNCTION STR(double v, sys d) as string
    if v < 0 then
        return str(v, d) '<-- crash here, removing second parameter fixes it.
    else
        return " " & str(v)
    end if
END FUNCTION

Charles Pegge

  • Guest
Re: Crash with STR
« Reply #1 on: November 15, 2018, 03:13:50 PM »
Brian,

This is an interesting dilemma which has arisen a few times before. I will see if there is an easy solution. Otherwise, the original str will have to be recreated using another name, to avoid recursion.

Brian Alvarez

  • Guest
Re: Crash with STR
« Reply #2 on: November 15, 2018, 03:35:13 PM »
I agree, the parameters could not make a difference.

For the moment, PluriBASIC is generating the name as STR_ this has solved the issue for now.
It is working fine.

Brian Alvarez

  • Guest
Re: Crash with STR
« Reply #3 on: December 09, 2018, 10:03:18 PM »
 This is a new crash with str. It only happens with 64 bit compilations.

Code: [Select]
long var = 2
print string(var, "0")

using a sys variable works fine.

Charles Pegge

  • Guest
Re: Crash with STR
« Reply #4 on: December 10, 2018, 01:00:00 AM »
It works fine for me. The bug causing this problem may be elsewhere. var is an overridable keyword, used in the RTLs but I don't think that is the cause.

Brian Alvarez

  • Guest
Re: Crash with STR
« Reply #5 on: December 10, 2018, 08:33:32 AM »
This is the whole code that is consistently crashing:

Code: [Select]
$ filename "str_example.exe"

uses rtl64

long v = 2
print string(v, "0")

Charles Pegge

  • Guest
Re: Crash with STR
« Reply #6 on: December 10, 2018, 08:53:25 AM »
Try this one with the RTLs and see if the crash still occurs. I have tested it with my key software, and Self-compiling of course.

https://github.com/Charles-Pegge/OxygenBasic/blob/master/OXSC181210.zip

Brian Alvarez

  • Guest
Re: Crash with STR
« Reply #7 on: December 10, 2018, 09:35:41 AM »
 This one works fine for this, but i think something changed because now my other code crashes.

 I will make more tests, maybe this one does something correctly and my old workarounds are
being trapped.

Brian Alvarez

  • Guest
Re: Crash with STR
« Reply #8 on: December 10, 2018, 12:07:23 PM »
 Charles, this update (121kb) is giving me trouble with macro members:

Code: [Select]
ERROR: Unable to find macro member
WORD: )
IN: pbmain
LINE: 125
FILE: "main source

 Rolling back to previous DLL (139kb) makes everything work again.