Compiler eats my string literals ^^

Just starting out? Need help? Post your questions and find answers here.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Compiler eats my string literals ^^

Post by Lunasole »

Last night in 5.42 I encountered very strange and rare bug which I cannot reproduce (and don't know exact conditions) so just posting here.

It was like that:
1. I've opened IDE
2. Loaded project, did something, ran it several times, saved & closed
3. Opened another code file (not project), and here bug appeared

In following code string "pMin = " just MISSED from ReplaceString() return and only result of StrF was used, that happened both when running with debugger and in resulting exe.
I wasted 30min trying to find wtf is wrong with code, testing with all those purifiers and so on. And then I just restarted IDE and bug disappeared :) Does anyone exposed such case?
It looks to be some general compiler bug, not with ReplaceString() or StrF() or other library functions.

Code: Select all

PAGE_LINK_MAIN$ = ReplaceString(PAGE_LINK_MAIN$, "%S4", "pMin = " + StrF(n_pMin / 1024, 1), #PB_String_CaseSensitive, 1, 1)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Fred
Administrator
Administrator
Posts: 18396
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Compiler eats my string literals ^^

Post by Fred »

If you use OS X or Linux 64-bit it could be the same issue as this: http://www.purebasic.fr/english/viewtop ... 24&t=62842
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Re: Compiler eats my string literals ^^

Post by helpy »

I once had the same problem. It was just an assignment (stringVar.s = "a string"). It was not executed after compilation (with and without debugger).

After restart of IDE IT worked.
I never could reproduce it.

This happend on Windows 7 64 Bit.
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Compiler eats my string literals ^^

Post by Lunasole »

Fred wrote:If you use OS X or Linux 64-bit it could be the same issue as this
No, that was on Win x86. No any crash or other visible errors, just few hardcoded strings (from a very many other hardcoded) were present in code and missing in executable. The StrF() return or other functions returns seems never missing, as I experimented with them when bug appeared.


helpy wrote:I once had the same problem. It was just an assignment (stringVar.s = "a string"). It was not executed after compilation (with and without debugger).

After restart of IDE IT worked.
I never could reproduce it.

This happend on Windows 7 64 Bit.
Yes, that looks like my case
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: Compiler eats my string literals ^^

Post by doctorized »

Some rare times, with older 5.x versions I realized that some piece of code was not working properly. I tried to find out what was going on and when I was closing PB and ran it again, everything where back to normal. I was thinking that, maybe, I was loading something and I was not freeing it properly, but now I think it could be some sort of bug, as in some of these cases, the code was not doing something very "special" to have this behavior.
Fred
Administrator
Administrator
Posts: 18396
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Compiler eats my string literals ^^

Post by Fred »

That could happens as we clean the compiler at every compile to not reload it from scratch and gain a few seconds. I would be interested to find a way to reproduce such issue, as it can be wierd to experience for sure.
User avatar
dobro
Enthusiast
Enthusiast
Posts: 766
Joined: Sun Oct 31, 2004 10:54 am
Location: France
Contact:

Re: Compiler eats my string literals ^^

Post by dobro »

@Fred:
as you know, with my editor (EPB)
I raise the compiler from scratch at each compilation
and frankly, we can not speak of "seconds"
I do not notice any particular downturn revive the compiler each time,
rather than leaving it in Ram ..

nowadays computers are anyway veloce, not to have this problem ... :)

******** in Froggy's *************** Image

comme tu le sais , avec mon Editeur (EPB)
je relance le compilateur a partir de zero a chaque compilation
et franchement, on ne peut pas parler de "secondes"
je ne note pas de ralentissement particulier a relancer le compilateur a chaque fois,
plutot que de le laisser en Ram ..

de nos jours les ordinateurs sont quand meme assez veloce, pour ne pas avoir ce probleme ... :)
Image
Windows 98/7/10 - PB 5.42
■ sites : http://michel.dobro.free.fr/
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Compiler eats my string literals ^^

Post by Lunasole »

I'll just up this topic, maybe there will be some more ppl encountered it?

For this time I already tried about 40 various scenario trying to reproduce that rare and really sneaky bug for interest, but all failed (5.42) ^^
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Post Reply