"for (;;)" in ZScript crashes GZDoom

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: "for (;;)" in ZScript crashes GZDoom

Re: "for (;;)" in ZScript crashes GZDoom

by _mental_ » Sat Sep 15, 2018 7:44 am

Fixed in 7d1af25.

Re: "for (;;)" in ZScript crashes GZDoom

by _mental_ » Fri Sep 14, 2018 2:16 am

Code of such for loop is not generated at all. Made PR with the fix to be sure that it's OK to fix the problem this way.

Re: "for (;;)" in ZScript crashes GZDoom

by phantombeta » Fri Sep 14, 2018 1:58 am

Graf Zahl wrote:The return type mismatch is because the compiler is not smart enough to detect that the end of the loop is never reached. So it sees both a boolean return and a void return and complains about it.
Yeah, I'm aware of that, which is why I suspect something is going horribly wrong when it tries to compile the "for (;;)" loop.
... Which the disassembly seems to agree with. There's no disassembly for TestActor's "a" function in it at all.
Here's the disassembly if you want to take a look.

Re: "for (;;)" in ZScript crashes GZDoom

by Graf Zahl » Fri Sep 14, 2018 12:14 am

The return type mismatch is because the compiler is not smart enough to detect that the end of the loop is never reached. So it sees both a boolean return and a void return and complains about it.
I cannot run this myself until late this evening, so if you could run this thing with "-dumpdisasm" and post the output I may give some feedback earlier.

"for (;;)" in ZScript crashes GZDoom

by phantombeta » Thu Sep 13, 2018 7:44 pm

Exactly what it says on the thread title.

Steps to reproduce:
  • Start a new game with the attached PK3 loaded
  • Summon "TestActor"
Based on a few observations, I'm guessing either the compiler backend or the compiler frontend is compiling it completely wrong. It doesn't even start if you replace the "for (;;)" loop with a "while (true)" loop, as it errors out with the "Return type mismatch" error, which doesn't happen at all with the "for (;;)" loop.
Attachments
ZScriptForLoopCrash.pk3
(265 Bytes) Downloaded 23 times

Top