pouët.net

code crashes in release build

category: code [glöplog]
 
hi everyone,
I'm encountering a strange problem in my C++ project in which it crashes / wont work properly in release mode....

could someone please help? I've marked the spot that might be the problem in main.cpp

http://rghost.net/private/46084460/e2c63a4e130301e79cf4500e0be51480
added on the 2013-05-18 12:33:04 by zorke zorke
first bug:
Code: char xmlist[][MAX_PATH]={"pk_lemming.xm", "pk_lz0_12.xm", "pk_lz0_14.xm", "pk_orgie.xm"\ "pk_sleepless.xm", "pk_stn.xm"};

added on the 2013-05-18 13:12:19 by the_Ye-Ti the_Ye-Ti
It's 2013. I guess your inline assembly stuff might be somewhat error prone.
Maybe it's RandomInt()... I don't see why exactly you need inline assembly for what you are doing.

Try to replace all asm-codeparts with proper C/C++ code - I see nothing in your asm code which the compiler wouldn't optimize better than you did.

Well and given that I only have a 2012 Ultimate here - I only had a rough look at it. Get rid of all the unnecessary asm-parts and ask again.
added on the 2013-05-18 13:13:31 by las las
las: it is RandomInt() - there's no MSB / sign check so it occasionally returns negative :)

replace with
Code:unsigned int RandSeed[2] = {0x0A2F59C2,0x05B2A10E9}; /* code */ unsigned int RandomInt(int RNGRange) { RandSeed[0] += 0x3b1c62e9; return RandSeed[0] % RNGRange; }


and it works fine.
added on the 2013-05-18 13:21:51 by Gargaj Gargaj
Why doesn't it crash in debug mode as well?
added on the 2013-05-18 16:39:39 by Adok Adok
Quote:
Why doesn't it crash in debug mode as well?


have you ever done any actual programming or?
added on the 2013-05-18 17:36:36 by superplek superplek
Quote:
Why doesn't it crash in debug mode as well?


Usually because you don't initialize some variables.
added on the 2013-05-18 17:54:26 by swapd0 swapd0
ok, all fixed :) thanks
added on the 2013-05-19 11:27:02 by zorke zorke
For what it's worth, I also recommend getting rid of the inline assembler. With this kind of code, it's totally useless.
added on the 2013-05-19 11:55:55 by Preacher Preacher
well, I've ported almost all the other functions to C....
C seems a lot better than asm indeed
added on the 2013-05-19 12:09:11 by zorke zorke

login