View unanswered posts | View active topics It is currently Thu Nov 27, 2014 9:17 am






Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753 
Author Message
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
:breakcomputer:
Code:
short array2[124]; //If size of this array is less than 124 all works

task main() {
  ubyte array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
    a = array[i];
}

What I need to do with this bug? I download this program intro the NXT and after it starts NXT ceases to react to pressing of any button. :cry:


Fri Oct 24, 2008 11:43 am
Profile
Expert
User avatar

Joined: Sat Sep 20, 2008 12:16 pm
Posts: 106
Location: Curently fighting aliens on P3X-828
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
a short can be from 0 to 123. Anything outside of that will crash the system.

_________________
:downloading:
Sorry, your program could not be downloaded. Please reboot your computer.
FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)
Quote:
What the world needs is more geniuses with humility, there are so few of us left.

Agreed


Fri Oct 24, 2008 1:17 pm
Profile WWW
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
But why? This code works successful:
Code:
short array2[124];

task main() {
  ubyte array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
    a = array2[i];
}


Sat Oct 25, 2008 1:43 am
Profile
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
One more sample.
It works:
Code:
byte array[2];
byte array2[360];

task main() {

  long a = 0; int i;
  for (i = 0; i < 2; i++)
    a = array[i];
  for (i = 0; i < 2; i++)
    a = array2[i];
}

But it doesn't:
Code:
byte array2[360];
byte array[2];

task main() {

  long a = 0; int i;
  for (i = 0; i < 2; i++)
    a = array[i];
  for (i = 0; i < 2; i++)
    a = array2[i];
}


Sat Oct 25, 2008 2:00 am
Profile
Expert
User avatar

Joined: Sat Sep 20, 2008 12:16 pm
Posts: 106
Location: Curently fighting aliens on P3X-828
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
Then WHY are you asking in the first place?

_________________
:downloading:
Sorry, your program could not be downloaded. Please reboot your computer.
FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)
Quote:
What the world needs is more geniuses with humility, there are so few of us left.

Agreed


Sat Oct 25, 2008 5:08 am
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3293
Location: Rotterdam, The Netherlands
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
I don't think that the order of those two array declarations should matter. If the program really doesn't work because of this then it's a bug and should be treated as such.

An array of shorts should not be limited to merely 123 values, that is just nonsense. The values of the actual shorts in the array are limited, sure, but they're both very different things. Also, a short seems to be the same as an int on RobotC, at least according to CompilerTypedefs.h. There is a total of about 15k variable space, surely an array's total size is not limited to merely 246 bytes?.

Also, you use the ubyte type, this is not an unsigned byte as the name might suggest. In fact, RobotC doesn't honour the concept of unsigned/signed, all types are signed, even if you use the "u" version.

Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Oct 25, 2008 5:40 am
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
yes,
Xander is right,
short and int are the same in RobotC, the range is -32768 to +32767
byte and char both are -128...+127
and ubyte does not exist, so it should be handled like this.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Mon Oct 27, 2008 5:16 am, edited 2 times in total.



Sat Oct 25, 2008 5:48 am
Profile
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
Thanks for all, I will consider it, but how I can solve this problem? I haven't a lot of time because I will show my project on WRO 2008 (2nd of November). I have already sent the bug report.


Sat Oct 25, 2008 6:28 am
Profile
Rookie

Joined: Sat Apr 19, 2008 11:51 am
Posts: 43
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
hi,
faulty byte arithmetics (by arrays and structures) have been an issue from release 1.05 up to 1.35 (?)
did you try
Code:
a = (long)array[i];
...
a = (long)array2[i];


still the same?


Sat Oct 25, 2008 6:34 am
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
ROBOTC 1.45:
1st try: array2[125];
compiler error: **Error**:Multiple overloads for 'nxtDisplayTextLine' match [including some numeric conversions] that must not be!
Code:
short array2[125];
task main() {
  ubyte array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
  {
     a = array[i];
     nxtDisplayTextLine(i, "%3d%3d",array[i],a);
  }
    while(true) {}
}


2nd try: array2[125];
run time error: nxt blocks, debugger blocks, program hangs up, cold reboot needed
although short array2 is never assigned
Code:
short array2[125];
task main() {
  ubyte array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
  {
     a = array[i];
     nxtDisplayTextLine(i, "%3d%3d", (int)array[i], a);
  }
    while(true) {}
}


3rd try: array2[120];
runs fine
Code:
short array2[120]; // size =120 , although not assigned

task main() {
  ubyte array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
  {
     a = array[i];
     nxtDisplayTextLine(i, "%3d%3d",(int)array[i],a);
  }
    while(true) {}
}


4th try: short array2[125]; but: byte array[] = {1, 0};
run time error: nxt blocks, debugger blocks, program hangs up, cold reboot needed.
although short array2 is never assigned
Code:
short array2[125]; //

task main() {
  byte array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
  {
     a = array[i];
     nxtDisplayTextLine(i, "%3d%3d",(int)array[i],a);
  }

    while(true) {}
}


5th try: both short array2[125]; and short array[] = {1, 0};
runs fine

Code:
short array2[125]; //

task main() {
  short array[] = {1, 0};

  long a = 0; int i;
  for (i = 0; i < 2; i++)
  {
     a = array[i];
     nxtDisplayTextLine(i, "%3d%3d",(int)array[i],a);
  }

    while(true) {}
}


so with byte array or ubyte array anywhere in the source there is a crash, if another array exceeds the size of [123],
and with only short arrays overall, there never is a crash.

If that's no bug, my name should be Gantenbein.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Sun Oct 26, 2008 7:30 pm, edited 1 time in total.



Sat Oct 25, 2008 6:54 am
Profile
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
Thanks! I will test your idea in my robot...


Sat Oct 25, 2008 10:31 am
Profile
Expert
User avatar

Joined: Sat Sep 20, 2008 12:16 pm
Posts: 106
Location: Curently fighting aliens on P3X-828
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
I thought so. That's not a bug in the firmware, that's a bug in the program. As I said before, a short can be between 0 and 123, anything else is just asking for trouble. This happened to me once with parallax PBASIC, and again in a computer program in DEV C++.

_________________
:downloading:
Sorry, your program could not be downloaded. Please reboot your computer.
FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)
Quote:
What the world needs is more geniuses with humility, there are so few of us left.

Agreed


Sat Oct 25, 2008 7:23 pm
Profile WWW
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
In Dev-C++ it's impossible... If it's posiible, can you take me some examples of badly working program?


Sun Oct 26, 2008 2:12 am
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
CC335 wrote:
I thought so. That's not a bug in the firmware, that's a bug in the program. As I said before, a short can be between 0 and 123, anything else is just asking for trouble.

This is defintively absolute nonsense!
short and int are the same in RobotC! Both have a range from -32768 to +32767.

And if you had taken the time to read through my test code examples, you would have seen that

the code DOES work with
short array2[125] (5th try),

but does NOT work with
byte array2[125] (4th try),

although both arrays never have been used or assigned to any another variable or function.
And besides this, in the test code only values of 0 and 1 have been used, so there won't be any overflow beyond "123".

Got me?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Mon Oct 27, 2008 5:16 am, edited 2 times in total.



Sun Oct 26, 2008 5:45 am
Profile
Expert
User avatar

Joined: Sat Sep 20, 2008 12:16 pm
Posts: 106
Location: Curently fighting aliens on P3X-828
Post Re: SERIOUS AND INSULTING BUG OF NXT'S FIRMWAFE robotc 1.40 753
Sorry. Got the Short command mixed with PBASIC.

_________________
:downloading:
Sorry, your program could not be downloaded. Please reboot your computer.
FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)
Quote:
What the world needs is more geniuses with humility, there are so few of us left.

Agreed


Sun Oct 26, 2008 5:38 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.