Freebasic 1.20.0 Development

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
Xusinboy Bekchanov
Posts: 879
Joined: Jul 26, 2018 18:28

Re: Freebasic 1.20.0 Development

Post by Xusinboy Bekchanov »

After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
coderJeff
Site Admin
Posts: 4386
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Freebasic 1.20.0 Development

Post by coderJeff »

Xusinboy Bekchanov wrote: Mar 30, 2025 8:08 After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
I cannot reproduce an overflow error. I tried UTF16LE format of source and latest development fbc 64-bit.
Xusinboy Bekchanov
Posts: 879
Joined: Jul 26, 2018 18:28

Re: Freebasic 1.20.0 Development

Post by Xusinboy Bekchanov »

coderJeff wrote: Mar 31, 2025 8:29
Xusinboy Bekchanov wrote: Mar 30, 2025 8:08 After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
I cannot reproduce an overflow error. I tried UTF16LE format of source and latest development fbc 64-bit.
The last one is the one from 03/16/2025?
I have all the sources in UTF8 (BOM).
Xusinboy Bekchanov
Posts: 879
Joined: Jul 26, 2018 18:28

Re: Freebasic 1.20.0 Development

Post by Xusinboy Bekchanov »

Xusinboy Bekchanov wrote: Apr 01, 2025 15:46
coderJeff wrote: Mar 31, 2025 8:29
Xusinboy Bekchanov wrote: Mar 30, 2025 8:08 After compiling this example with the latest versions of the compiler 64-bit, this code will fail with an overflow error:

Code: Select all

?Val("1")

Sleep
This happens when the file is a Unicode version.

Because of this, the IDE cannot start:
viewtopic.php?p=306853#p306853
I cannot reproduce an overflow error. I tried UTF16LE format of source and latest development fbc 64-bit.
The last one is the one from 03/16/2025?
I have all the sources in UTF8 (BOM).
Hello, I found a solution to this problem. When copying the compiler from this link https://users.freebasic-portal.de/stw/builds/win64/ and copying the lib files without overwriting the existing lib files then this code works without problems. Thanks.
fxm
Moderator
Posts: 12576
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.20.0 Development

Post by fxm »

About the new fix-len string ('String * N') definition since fbc version 1.20.0
('String * N' now occupies N bytes and has no terminating null character)

Bug to initialize a structure mixing such fix-len string with numeric data.

Example using a temporary type as initializer:

Code: Select all

Type UDT0
    Dim As String * 10 s
End Type

Type UDT1
    Dim As Integer i
    Dim As String * 10 s
End Type

Type UDT2
    Dim As String * 10 s
    Dim As Integer i
End Type

Dim As UDT0 u0 = Type("FreeBASIC")     '' ok
Dim As UDT1 u1 = Type(1, "FreeBASIC")  '' compile error
Dim As UDT2 u2 = Type("FreeBASIC", 2)  '' compile error

Defining an explicit constructor solves the previous problem:

Code: Select all

Type UDT0
    Dim As String * 10 s
End Type

Type UDT1
    Dim As Integer i
    Dim As String * 10 s
    Declare Constructor(Byval _i As Integer, Byref _s As String)
End Type
Constructor UDT1(Byval _i As Integer, Byref _s As String)
    i = _i
    s = _s
End Constructor

Type UDT2
    Dim As String * 10 s
    Dim As Integer i
    Declare Constructor(Byref _s As String, Byval _i As Integer)
End Type
Constructor UDT2(Byref _s As String, Byval _i As Integer)
    s = _s
    i = _i
End Constructor

Dim As UDT0 u0 = Type("FreeBASIC")     '' ok
Dim As UDT1 u1 = Type(1, "FreeBASIC")  '' ok
Dim As UDT2 u2 = Type("FreeBASIC", 2)  '' ok
coderJeff
Site Admin
Posts: 4386
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Freebasic 1.20.0 Development

Post by coderJeff »

fxm wrote: Apr 11, 2025 19:20 About the new fix-len string ('String * N') definition since fbc version 1.20.0
('String * N' now occupies N bytes and has no terminating null character)
fxm, thanks for the report. I think the surface level bug is that the compiler error message doesn't describe the actual problem, so is confusing for the user what steps are needed to correct.

At the very least should report that a matching constructor was not found.

We could probably do better, and here is background information:

a TYPE that is initialized by default all zeroes gets initialized with a Fill(0) instruction (includes numbers, ZSTRING*N, and STRING)
a TYPE consisting of only STRING*N gets initialized with a Fill(32) instruction, and end padded with Fill(0) if required
a TYPE requiring a mix of Fill(0) and Fill(32) instructions induces the generation of an implicit default constructor

fbc currently handles any TYPE with a constructor, which could be implicitly generated and explicitly declared, as an object and checks for a constructor for matching arguments is checked, and makes decisions based on the TYPE being a kind of object.

I think initialiers could be improved by tracking internally when a constructor is one and only implicitly generated constructor and make a different logic decision about how the TYPE may be initialized - i.e. checking against the TYPE fields by default instead of looking for a matching constructor, and also ensuring that the default implicit constructor is called before initializing fields with the user's initializer list.

There is potential in this work to improve initializers for all TYPE's where a default constructor was the one and only constructor implicitly generated; where user did not declare any constructor for the TYPE, but one was generated internally, permit a default initializer list based on the TYPE declaration.
fxm
Moderator
Posts: 12576
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.20.0 Development

Post by fxm »

Parsing 'Type[<UDT>](...)' usage and outputting a possible error message is complex, because the 'Type[<UDT>](...)' functionality itself is complex (maybe too much):
- 'Type[<UDT>]()' (without parameter) is only valid if there is a default constructor (implicit or explicit).
- 'Type[<UDT>](arg, ...)' (with at least one parameter) is only valid if there is no constructor (implicit or explicit) or if there is a matching constructor.
(when 'Type[<UDT>](...)' calls a constructor, this is equivalent to 'UDT(...)', so there are 2 different syntaxes to do the same thing)
Provoni
Posts: 525
Joined: Jan 05, 2014 12:33
Location: Belgium

Re: Freebasic 1.20.0 Development

Post by Provoni »

Hi all,

Where can I find a FreeBASIC release using GCC 13?

Tyvm
srvaldez
Posts: 3646
Joined: Sep 25, 2005 21:54

Re: Freebasic 1.20.0 Development

Post by srvaldez »

Hi Provoni :)
I guess that your OS is Windows ?
do you want FB-1.10.1 or the latest 1.20 ?
any reason not to use gcc-15.1 ? (which is the latest at the moment)

I personally like to build FB with the version of gcc that will be included with FB

OK, just in case you are interested here's FreeBASIC-1.20.0-win-gcc-15.1w https://u.pcloud.link/publink/show?code ... 1nw4o98ylk
winlibs gcc-15.1
Provoni
Posts: 525
Joined: Jan 05, 2014 12:33
Location: Belgium

Re: Freebasic 1.20.0 Development

Post by Provoni »

Hey srvaldez,

Yes, Windows. I looked up from which GCC version my CPU (Zen 4) was supported and arrived at 13 (not wanting to ask to much).

Thank you for the build. I'm flabbergasted by how much the build improved the speed of my code. It actually doubled in one case. I am training very small binary neural networks to emulate small language models (SLM instead of LLM if you may) with the emphasis on processing as many tokens per second as possible (on CPU) and the tokens per second (in training) jumped from 16 billion to 32 billion.

Thank you.
srvaldez
Posts: 3646
Joined: Sep 25, 2005 21:54

Re: Freebasic 1.20.0 Development

Post by srvaldez »

Hi Provoni :)
I just built FB-1.20 with gcc-13.1 in case you are still interested https://u.pcloud.link/publink/show?code ... Vr35kIOwpX
coderJeff
Site Admin
Posts: 4386
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Freebasic 1.20.0 Development

Post by coderJeff »

Provoni wrote: May 29, 2025 12:18 Where can I find a FreeBASIC release using GCC 13?
srvaldez wrote: May 29, 2025 13:09 I personally like to build FB with the version of gcc that will be included with FB
I really appreciate the packaged builds you put out. Super helpful, thank-you.

For me, earlier in the year I had set some goals for getting to the next fbc release. ( Darn job and life and stuff keeps me busy :D )

My goal was to put out a 1.10.3 maintenance release that was well tested for building itself and for building 1.20.0. I started a few months ago and it has been quite a process. I think I have all the packages I am willing to make. I need to upload the files and write the release announcement. Note these do not solve problems with gdb debugger, or adding external libraries or tools. It's just to maintain continuity of building fbc and run time itself.

Here is a list of packages that am planning to upload, fully tested, either in virtual machines, or on native hardware:

Code: Select all

ubuntu-14.04-x86      linux-x86               
ubuntu-14.04-x86_64   linux-x86_64            
ubuntu-16.04-x86      linux-x86               
ubuntu-16.04-x86_64   linux-x86_64            
ubuntu-18.04-x86      linux-x86               
ubuntu-18.04-x86_64   linux-x86_64            
ubuntu-20.04-x86_64   linux-x86_64            
ubuntu-22.04-x86_64   linux-x86_64            
ubuntu-24.04-x86_64   linux-x86_64
windows               documentation                  
windows               win32                   
windows               win64                   
windows               win32-mingworg          
windows               win32-gcc-5.2.0         
windows               win64-gcc-5.2.0         
windows               win32-gcc-7.1.0         
windows               win64-gcc-7.1.0         
windows               win32-gcc-8.1.0         
windows               win64-gcc-8.1.0         
windows               win32-gcc-11.2.0        
windows               win64-gcc-11.2.0        
windows               win32-gcc-13.2.0        
windows               win64-gcc-13.2.0        
windows               win32-winlibs-gcc-11.3.0
windows               win64-winlibs-gcc-11.3.0
windows               win32-winlibs-gcc-9.3.0 
windows               win64-winlibs-gcc-9.3.0 
winxp                 dos                     
winxp                 win32-mingworg          
raspbian9-arm         linux-arm               
rpios10-arm           linux-arm               
rpios11-arm           linux-arm               
rpios11-aarch64       linux-aarch64           
rpios12-armhf         linux-arm               
rpios12-aarch64       linux-aarch64           
debian11-arm          linux-arm               
debian12-armhf        linux-arm               
ubuntu-22.04-aarch64  linux-aarch64           
ubuntu-24.04-aarch64  linux-aarch64           
freebsd-13.0-x86      freebsd-x86             
freebsd-13.0-x86_64   freebsd-x86_64          
freebsd-13.4-x86      freebsd-x86             
freebsd-13.4-x86_64   freebsd-x86_64    
I know several of these hosts (packages) are not important to anyone but me. But I wanted to do this for 1.10.3, even if fbc 1.20.0 is released with far fewer packages.
Provoni
Posts: 525
Joined: Jan 05, 2014 12:33
Location: Belgium

Re: Freebasic 1.20.0 Development

Post by Provoni »

@coderJeff,

Good idea, GCC 13 can offer huge performance gains on modern systems.

Thank you for everything!
Post Reply