SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 15/11/2013, 02:14 PM   #1
dudaefj
Huge Clucker
 
dudaefj's Avatar
 
Join Date: Jul 2011
Posts: 344
Reputation: 19
Default runtime pawn bug

I don't really know if it's an unknow bug, but I just found it so I wanna share and get your opinion guys

PHP Code:
#include        <a_samp>

new TesteVar[5][3];

public 
OnGameModeInit()
{
    for(new 
0100i++)
        
printf("TesteVar[%d][0] = %d"iTesteVar[i][0]);


if you compile that on -d 0, it won't break by runtime error on right place
that was my console output:
Quote:
[15/11/13 13:11:25] TesteVar[0][0] = 0
[15/11/13 13:11:25] TesteVar[1][0] = 0
[15/11/13 13:11:25] TesteVar[2][0] = 0
[15/11/13 13:11:25] TesteVar[3][0] = 0
[15/11/13 13:11:25] TesteVar[4][0] = 0
[15/11/13 13:11:25] TesteVar[5][0] = 0
[15/11/13 13:11:25] TesteVar[6][0] = 0
[15/11/13 13:11:25] TesteVar[7][0] = 0
[15/11/13 13:11:25] TesteVar[8][0] = 0
[15/11/13 13:11:25] TesteVar[9][0] = 0
[15/11/13 13:11:25] TesteVar[10][0] = 0
[15/11/13 13:11:25] TesteVar[11][0] = 0
[15/11/13 13:11:25] TesteVar[12][0] = 0
[15/11/13 13:11:25] TesteVar[13][0] = 0
[15/11/13 13:11:25] TesteVar[14][0] = 0
[15/11/13 13:11:25] TesteVar[15][0] = 0
[15/11/13 13:11:25] TesteVar[16][0] = 0
[15/11/13 13:11:25] TesteVar[17][0] = 0
[15/11/13 13:11:25] TesteVar[18][0] = 0
[15/11/13 13:11:25] TesteVar[19][0] = 0
[15/11/13 13:11:25] TesteVar[20][0] = 0
[15/11/13 13:11:25] TesteVar[21][0] = 0
[15/11/13 13:11:25] TesteVar[22][0] = 0
[15/11/13 13:11:25] TesteVar[23][0] = 0
[15/11/13 13:11:25] TesteVar[24][0] = 0
[15/11/13 13:11:25] TesteVar[25][0] = 0
[15/11/13 13:11:25] TesteVar[26][0] = 0
[15/11/13 13:11:25] TesteVar[27][0] = 0
[15/11/13 13:11:25] TesteVar[28][0] = 0
[15/11/13 13:11:25] TesteVar[29][0] = 1677721600
[15/11/13 13:11:25] TesteVar[30][0] = 0
[15/11/13 13:11:25] TesteVar[31][0] = 0
[15/11/13 13:11:25] TesteVar[32][0] = 0
[15/11/13 13:11:25] TesteVar[33][0] = 0
[15/11/13 13:11:25] TesteVar[34][0] = 0
[15/11/13 13:11:25] TesteVar[35][0] = 0
[15/11/13 13:11:25] TesteVar[36][0] = 0
[15/11/13 13:11:25] TesteVar[37][0] = 0
[15/11/13 13:11:25] TesteVar[38][0] = 0
[15/11/13 13:11:25] TesteVar[39][0] = 0
[15/11/13 13:11:25] TesteVar[40][0] = 0


and if you compile that with -d 2, it breaks by runtime error on right place:
Quote:
[15/11/13 13:14:13] TesteVar[0][0] = 0
[15/11/13 13:14:13] TesteVar[1][0] = 0
[15/11/13 13:14:13] TesteVar[2][0] = 0
[15/11/13 13:14:13] TesteVar[3][0] = 0
[15/11/13 13:14:13] TesteVar[4][0] = 0
dudaefj is offline   Reply With Quote
Old 16/11/2013, 09:35 PM   #2
Memoryz
Gangsta
 
Join Date: Dec 2008
Posts: 724
Reputation: 26
Default Re: runtime pawn bug

The array you create is only 5 elements large in the first-dimension, yet you try to access values larger than the size. I don't know what you were expecting but you can't access array values that do not exist in an array.
Memoryz is offline   Reply With Quote
Old 16/11/2013, 09:43 PM   #3
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,841
Reputation: 1399
Default Re: runtime pawn bug

Quote:
Originally Posted by Memoryz View Post
The array you create is only 5 elements large in the first-dimension, yet you try to access values larger than the size. I don't know what you were expecting but you can't access array values that do not exist in an array.
He knows that, what he tried to say is that compiling with -d2 breaks (stops) the code (in this case the loop) from continuing accessing the element at an invalid index while compiling with -d0 doesn't stop the code and it keeps looping with all the invalid indexes.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 21/11/2013, 10:43 PM   #4
dudaefj
Huge Clucker
 
dudaefj's Avatar
 
Join Date: Jul 2011
Posts: 344
Reputation: 19
Default Re: runtime pawn bug

Quote:
Originally Posted by Memoryz View Post
The array you create is only 5 elements large in the first-dimension, yet you try to access values larger than the size. I don't know what you were expecting but you can't access array values that do not exist in an array.
wtf !?
which one?
1) my english is so bad?
2) can't you read?
3) are you re**** ?


Quote:
Originally Posted by Konstantinos View Post
He knows that, what he tried to say is that compiling with -d2 breaks (stops) the code (in this case the loop) from continuing accessing the element at an invalid index while compiling with -d0 doesn't stop the code and it keeps looping with all the invalid indexes.
yeah...
the worst part is if you change values on loop to index > 5, it will change some "random" (I know it's not really random) value on memory, of any other var on the gamemode!
dudaefj is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RunTIme Error from Client... Mircrosoft Visual c++ Runtime Libary asdfgh98 Client Support 0 22/02/2010 03:08 PM
Microsoft visual c++ runtime library Runtime error! waringzone Client Support 3 16/06/2009 07:41 PM
Runtime Eror Microsoft Visual C++ Runtime Library Chriso Client Support 1 17/04/2009 05:57 PM


All times are GMT. The time now is 09:42 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.