Page 3 of 4

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Sun Feb 14, 2021 11:23 pm
by infratec
Can you reproduce the bug without using any BF stuff?

If not, maybe there is somewhere a memory/pointer bug in BF.
If yes, please provide a full working code which shows the error, that we can jump in and investigate that behaviour.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Sun Feb 14, 2021 11:33 pm
by Saki
Hi
As already said.
This error occurs very rarely and I cannot explain the cause.
And the code works perfectly under Linux and Windows.
And it cannot be reproduced in a mini or any larger pseudo code.
So you need at least one Mac to be able to see the error in the first place.

If I move the parameter up four places and the error moves exactly with it, how is that going to work?
Try to reproduce this bug, it doesn't work.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Sun Feb 14, 2021 11:44 pm
by Tenaja
Saki wrote:Hi Tenaja,
show me the mistake I made.
The localisation of programming errors is always based on facts, not on assumptions.
No offence, but you can't judge my codes negatively without knowing them.
I was paraphrasing Paul. If, in fact, you are using go-to in contradiction to the manual, then you need to remove all of them before claiming there's a bug in the compiler. I'm not saying you are doing that, but that is what I understand from what Paul wrote.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Sun Feb 14, 2021 11:55 pm
by Saki
Hi Tenaja
It's not true at all, it's absolutely wrong.
Go to the codes, search for Goto, there is not a single Goto in the entire FontWizzard.
In the entire GFX_Wizzard_BF, Goto is only used twice.
Once when an error occurs in the progress bar, which has never happened until now.
The second time is when searching for an unused colour in an image,
which is absolutely rare and absolutely simple, a few lines all over.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 12:03 am
by Mijikai
Saki wrote:In the whole GFX_Wizzard_BF 11 Goto are used with over 26 000 lines.
Saki wrote:...In the entire GFX_Wizzard_BF, Goto is only used twice.
Are you debugging an old version of that BF thing... :?:

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 12:16 am
by Saki
It occurs 11 times, of which 10 times it points to the same error routine
inside the same function that has never been triggered, its only a fuse....
Read the thread and you will find that too. :wink:

And again, I'm writing it very slowly now to read along.
There is no Goto in theFontWizzard.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 12:19 am
by idle
something odd is going on, the issue arises in the call to DrawText_FW, it does seem to be a parameter order issue

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 12:28 am
by idle
bug is in x64 call parsing, it is set off by a float of double parameter, if the last parameter is changed to an integer the code works

this code result is on linux x64 PB 5.72
g 7
h 10
bug below
g 8873415
h

Code: Select all

Procedure bar(a,b,c,d,e,f,g,h.s=" ",i=9,j.d=10.0) 
  
  Debug g
  Debug h 
   
EndProcedure   

Procedure foo() 
  Protected a,text.s    
  
  For a = 1 To 10 
    text=Str(a)
    bar(1,2,3,4,5,6,7,text,9,#PI)
  Next 
  
  Debug " bug below "
  
  For a = 1 To 10 
     bar(1,2,3,4,5,6,7,Str(a),9,#PI)
  Next 
    
EndProcedure 

foo()

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 1:00 am
by Saki
Hi Idle
You got it ?

I don't have a Mac on at the moment.

Great !

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 1:06 am
by idle
Saki wrote:Hi Idle
You got it ?

I don't have a Mac on at the moment.

Great !
I don't have windows either, it might just be linux x64 and osx

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 1:26 am
by Saki
It works with Windows, but I've also had these problems on all OS.

I haven't had Mac for long.

Best Regards Saki

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 1:30 am
by idle
that might be why it's gone under the radar, x64 call conventions are different for windows and linux / osx
I will post a bug report for linux and osx.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 1:59 am
by Saki
Yep, great !

Best Regards Saki

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 3:19 am
by BarryG
Saki wrote:I would have liked to make a small neutral code, but unfortunately I did not succeed.
In the older PureBasic days, when standalone snippets couldn't show the problem, Fred would ask for a copy of your entire code so he can test it. Maybe PM/email him and see if he's still willing to do that?

Because I can tell you now, unless Fred can see a proven bug then this will not get fixed or looked at, and just relegated to the realms of being a user error.

Re: The unknown dangerous Procedure StringFunction Bug

Posted: Mon Feb 15, 2021 4:51 am
by TI-994A
ProphetOfDoom wrote:Oh my! I don’t know where to begin. In Haskell, entire programs are glued together by higher-order functions. Gtk uses callbacks for every signal.
Let's begin with the fact that PureBasic does not implement a functional paradigm, nor does it natively support lambdas or higher-order functions. Then, let's also realise that callbacks in imperative and procedural languages (which PureBasic is), are passed as address pointers, and not as function types.

In this paradigmatic respect, to pass functions as arguments would mean to pass the unassigned function results directly. Not a good idea.

Context is always king.