ROBOTC.net forums
http://www.robotc.net/forums/

Compiler crash involving undefined procedures in functions
http://www.robotc.net/forums/viewtopic.php?f=63&t=5377
Page 1 of 1

Author:  akraut [ Wed Jan 16, 2013 4:41 pm ]
Post subject:  Compiler crash involving undefined procedures in functions

I'm getting an error that causes robotC to crash on compile with a generic "ROBOTC Integrated Development Environment has stopped working" message. (On older operating systems it simply closes with no message.) This is on RobotC 3.08, compiling for NXT. (Yes, I know it's old, but I just want to make sure it gets fixed if it hasn't been yet. If it's fixed on newer versions I figure my work here is done.)

The crash appears to occur whenever the following conditions are all met:
- A function has an undefined procedure in it. (like if you have a typo in a function name)
- The function takes at least one input.
- The function is correctly called, and its output is assigned to a variable.

The crash DOESN'T occur if the output is used, but not assigned to a variable. For example, if a function named testFunc has the error in it, the line

x = testFunc(100);

would cause the crash, but the line

if(testFunc(100)>50)

would not cause the crash.

My testing was done on Windows 7.

Like I said, this isn't stopping me from doing anything, since it only occurs when you'd have a compiler error anyway, but I really want to know how on earth there's a crash this specific, and I want to bring it to your attention if it's not already fixed.

Author:  mightor [ Thu Jan 17, 2013 2:18 am ]
Post subject:  Re: Compiler crash involving undefined procedures in functio

I am using 3.55 B 2 and this piece of code does not crash the IDE:

Code:
task main()
{
  int x;
  x = testFunc(100);
 
 
  if(testFunc(100)>50)
  {
    // do nothing
  }

}

I just get an error:
Code:
File "unknownfunctest.c" compiled on Jan 17 2013 07:17:25
**Error**:Undefined procedure 'testFunc'.
**Error**:Too many parameters specified. Call to 'testFunc'. Parameter: 'N/A' is '100' of type 'char'.
**Error**:Too many parameters specified. Call to 'testFunc'. Parameter: 'N/A' is '100' of type 'char'.


= Xander

Author:  akraut [ Thu Jan 17, 2013 2:25 pm ]
Post subject:  Re: Compiler crash involving undefined procedures in functio

Sorry, I wasn't clear enough. testFunc would need to be a real function, it's inside testFunc that needs to have an undefined procedure.

For example

Code:
int testFunc(int x)
{
  ait1Msec(1000);
  return x;
}

task main()
{
  int x = testFunc(100);
}


crashes my compiler.

Author:  mightor [ Thu Jan 17, 2013 3:30 pm ]
Post subject:  Re: Compiler crash involving undefined procedures in functio

I am running 3.55 B2 and I see this:
Code:
File "unknownfunccrash.c" compiled on Jan 17 2013 20:29:21
**Error**:Undefined procedure 'ait1Msec'.
**Error**:Too many parameters specified. Call to 'ait1Msec'. Parameter: 'N/A' is '1000' of type 'short'.
**Info***:'x' is written but has no read references


No crash.
Solution: update your ROBOTC. You can get 3.55 B2 from here: viewtopic.php?f=52&t=5122

= Xander

Author:  akraut [ Thu Jan 17, 2013 5:25 pm ]
Post subject:  Re: Compiler crash involving undefined procedures in functio

Ok, glad it got fixed since the release I'm running.

(Although I admit I'm slightly sad I'll probably never know what caused it.)

Author:  mightor [ Fri Jan 18, 2013 12:30 am ]
Post subject:  Re: Compiler crash involving undefined procedures in functio

akraut wrote:
(Although I admit I'm slightly sad I'll probably never know what caused it.)

A bug in the compiler or IDE, most likely :)

= Xander

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/