View unanswered posts | View active topics It is currently Sat Dec 15, 2018 2:00 pm






Reply to topic  [ 1 post ] 
Boolean Variables Memory Corruption 
Author Message
Rookie

Joined: Tue Jan 13, 2015 10:48 pm
Posts: 23
Post Boolean Variables Memory Corruption
I came across this bug while using my menu from my autonomous header. This menu takes various variables and then stores them into void pointers. While this menu is still buggy, the point is that it causes the NXT to freeze.
Example code:
Code:
#include "Autonomous_Funcs.h"

bool ramp = true;
bool fill;
bool kickstand = false;
bool test1 = true;
bool test2 = false;
bool test3 = true;
//4 is unlucky :P
bool test5 = true;
bool test6 = false;
bool test7 = true;

task main()
{
   configLine("", &ramp, "", "Ramp","Parking Zone");
   configLine("", &kickstand, "", "Yes", "No");
   configLine("", &test1, "", "Yes", "No");
   configLine("", &test2, "", "Yes", "No");
   configLine("", &test3, "", "Yes", "No");
   configLine("", &test5, "", "Yes", "No");
   configLine("", &test6, "", "Yes", "No");
   startDisplay(true, true);
   while(true){}
}


This program would cause the NXT to freeze upon getting to the point where it tries to access the value of the boolean via (bool *).
The following program does work:
Code:
#include "Autonomous_Funcs.h"

bool ramp = true;
bool fill;
bool kickstand = false;
bool fill1;
bool test1 = true;
bool fill2;
bool test2 = false;
bool fill3;
bool test3 = true;
bool fill5;
bool test5 = true;
bool fill6;
bool test6 = false;
bool fill7;
bool test7 = true;

task main()
{
   configLine("", &ramp, "", "Ramp","Parking Zone");
   configLine("", &kickstand, "", "Yes", "No");
   configLine("", &test1, "", "Yes", "No");
   configLine("", &test2, "", "Yes", "No");
   configLine("", &test3, "", "Yes", "No");
   configLine("", &test5, "", "Yes", "No");
   configLine("", &test6, "", "Yes", "No");
   startDisplay(true, true);
   while(true){}
}


In this program, I put in "filler" boolean variables and then kept the same code within the main task. This did work, and further testing led me to believe that every other boolean variable's memory address is corrupted. This did not happen with any other variable type.

To recreate this problem, all you must do is make a simple test program like the ones above and include the autonomous function.


Thu Jan 15, 2015 9:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.