[SOLVED - Win11 bug] bizarre behavior with multiple print statements

General FreeBASIC programming questions.
Post Reply
shadow008
Posts: 86
Joined: Nov 26, 2013 2:43

[SOLVED - Win11 bug] bizarre behavior with multiple print statements

Post by shadow008 »

EDIT:
This is almost certainly a bug or odd setting in the default windows 11 terminal. I changed the default terminal setting from "Let Windows Decide" to "Windows Console Host" and now things work.

I've pared down a bug in my project to this basic example. There appears to be some kind of memory corruption going on when calling print a bunch of times:

Code: Select all

type UDT
    
    declare constructor()
    dim value as integer
    
end type

constructor UDT()
    print "constructor!"
    for i as integer = 0 to 5
        print i
    next
end constructor

print "start"

dim test as UDT
dim test2 as UDT
dim test3 as UDT
dim test4 as UDT

print "finish"
sleep
Results in the following output:

Code: Select all

const
 0
 1
 2
 3
 4
 5
co
 0
 1
 2
 3
 4
 5
co
 0
 1
 2
 3
 4
 5
co
 0
 1
 2
 3
 4
 5
fi
(Yes, it really is missing the first half of the output text)
This will print normal and expected results if you were to, say, remove one of the 'dim test as UDT', but this shouldn't otherwise be wrong.
This is on windows 11 (and windows subsystem for linux 2.0), fbc 1.09, compiled with no extra flags. Does anyone else see this behavior happening? This seems so basic that the only thing to blame would be windows...
Last edited by shadow008 on Feb 27, 2023 19:38, edited 2 times in total.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: [Bug?] bizarre behavior with multiple print statements

Post by SARG »

No problem with windows 10 64bit / fbc 1.10

Could you upload the exe so we'll test on our system.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: [Bug?] bizarre behavior with multiple print statements

Post by grindstone »

Also no problem with WinXP 32bit / fbc 1.05
shadow008
Posts: 86
Joined: Nov 26, 2013 2:43

Re: [Bug?] bizarre behavior with multiple print statements

Post by shadow008 »

Since you asked for it:
Here's a link to the built exe
(The behavior shows with or without optimization flags so I compiled with -gen gcc -O 3)

I'm fairly convinced this is a bug in the windows 11 terminal (of which there are 6 different ones pre-installed...) as this works perfectly fine when run as administrator (which uses the "admin" terminal) but not when running in compatibility mode for windows 7 (which uses the default terminal). I also dusted off my windows 10 machine and it runs perfectly fine there as well. If this really is just a bug on the windows 11 side then I'm completely floored as to how microsoft got the most basic aspect of a terminal; rendering text; wrong. Hopefully it's just a terminal setting I can change...

EDIT:
I changed the default terminal from "Let Windows Decide" which was using the "Windows terminal" to "Windows console host" and things look to be working now.

What was that meme about every other windows release sucking?... I'm sure it's relevant here.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: [SOLVED] bizarre behavior with multiple print statements

Post by SARG »

Exe tested and working fine, obviously.

However weird problem on W11.
Post Reply