perl5matcher stackoverflow

This is really odd. I'm getting a stackoverflow error when uploading my sketch:

java.lang.StackOverflowError
at java.util.Vector.addElement(Unknown Source)
at java.util.Stack.push(Unknown Source)
at com.oroinc.text.regex.Perl5Matcher._pushState(Perl5Matcher.java)

My sketch has the following:

void sendFrame(bool data, const char *charPtr, bool nullTerm) {
if (nullTerm) {
// special handling for commands that end with null terminator. the write command will not write the term char so we must write it explicitely

But when I change remove " we must write it explicitely" from the end of the comment, it works

This is Arduino 17 on windows.

Andrew

that is odd, ive written comments longer than that in 17 with no issues (sofar) (windows)

sorry but no help from me :frowning:

btw, the same sketch uploads fine with 17 on mac

The problem was:

char x = '"';

should be

char x = '"';

This is a bug in the Arduino IDE since that is a legal assignment. What's weird is that the program worked up until it got to a certain size. In this case my comment triggered some condition.

Since comments are ignored by the compiler, it's difficult to believe that they are the cause of the problem.

The assignment of " (an escaped double quote) may be a legal assignment, but what value is actually placed in x?

It's likely that the invalid value in x was causing problems that didn't show up until x got put in a memory location that some code is overwriting, due to writing out-of-bounds, or mis-reading (again due to an out-of-bounds situation).

But the error was not occurring in the compiler -- it never even got to compilation. It was occurring in the IDE (java).

This is really odd. I'm getting a stackoverflow error when uploading my sketch:

If you never got to the compiler, what were you uploading?

To clarify, the error occurred when I hit the "upload" button, not when it was uploading, because it never got that far. That stacktrace indicates a java error in the IDE. Possibly in the oroinc library. Again, it didn't get to the compilation step.

As I modified the program, it got to a point where I could prevent the error if I removed an arbitrary chunk of code, but unfortunately I needed that code.

Here's another instance of the same problem http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234031376

Sorry about that. The IDE includes some relatively hacky code to preprocess your source code to add function prototypes. It's just a bunch of regular expressions that can get confused by certain unusual strings in your code (including within comments).

I added a note about this to troubleshooting guide: http://arduino.cc/en/Guide/Troubleshooting#stackoverflow

thanks

This problem nearly drove me crazy. Finally I discovered a debugging line:

Serial.println(" no registration file);

Adding the " at the end of the string fixed it fine.

I dimly remember sticking the line in about (probably exactly before) the time everything turned to worms