Page 1 of 1
Compiler eats my string literals ^^
Posted: Thu Jul 07, 2016 8:47 pm
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)
Re: Compiler eats my string literals ^^
Posted: Fri Jul 08, 2016 6:43 am
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
Re: Compiler eats my string literals ^^
Posted: Fri Jul 08, 2016 8:09 am
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.
Re: Compiler eats my string literals ^^
Posted: Fri Jul 08, 2016 6:16 pm
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
Re: Compiler eats my string literals ^^
Posted: Sat Jul 09, 2016 3:19 pm
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.
Re: Compiler eats my string literals ^^
Posted: Mon Jul 11, 2016 8:09 am
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.
Re: Compiler eats my string literals ^^
Posted: Mon Jul 11, 2016 10:45 am
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 ***************
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 ...

Re: Compiler eats my string literals ^^
Posted: Tue Jul 26, 2016 9:54 am
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) ^^