Compiler Problem: StackOverflowError

I have run into this a coupe of times.
Progress Bar and Icon remain active ---

Exception in thread "Thread-5" java.lang.StackOverflowError
	at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344)
	at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
	at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
	at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
	at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
	at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078)

It happens when I forget closing quotation marks in a print statement.

else if ((fractionf >= 0.7))
  { // we need to offset the current reading
    Serial.println ("Case D: 3/4);
    WriteTable(DegreeC,rawValueW-3,1);
    WriteTable(DegreeC+1,rawValueW+1,1);
  }

The offending line is: Serial.println (**"**Case D: 3/4);
There are no other print quoted strings past this point so the compiler tries to read in the rest of the file as the string.

sounds more like some preprocessing error to me but still a very nasty one. Thanks for sharing.

It happens when I forget closing quotation marks in a print statement.

You'd think that, after a while, you'd stop forgetting them. 8)

PaulS:

It happens when I forget closing quotation marks in a print statement.

You'd think that, after a while, you'd stop forgetting them. 8)

After a lot of year some people start to .... sorry forgot what I was going to write. :%

robtillaart:
sounds more like some preprocessing error to me but still a very nasty one. Thanks for sharing.

Its the Arduino IDE not the gnu tools.
The IDE does some preprocessing but its parser isn't very robust and crashes on
certain sequences.

--- bill

You are both correct I believe.
More Info:
Apparently this ONLY occurs on source files of a certain size. For smaller files it gives the error "missing terminator". I would guess it is reading into a buffer and over runs the buffer.

Just out of curiosity I tried it in "Arduino ERW 1.0.5": Ditto.

This could be very perplexing for a NEW user that does not know what to look for (of course they will likely not be working with larger files). If knowing there is a problem is half the solution then knowing what the problem is could be 3/4 of the solution. Perhaps someone can take a look at fixing it for the next release.

Just out of curiosity, have you tried to replicate this with the latest 1.5.x beta? (I'm wondering if the fix exists, but never trickled back to the 1.0.x stable branch.)

Sembazuru:
Just out of curiosity, have you tried to replicate this with the latest 1.5.x beta? (I'm wondering if the fix exists, but never trickled back to the 1.0.x stable branch.)

ahh .... no. I generally do not load Beta software (I get into enough trouble with the fully released versions :P).
I might try in on a virtual machine though.

Where might the Beta version be found ?

lewtwo:

Sembazuru:
Just out of curiosity, have you tried to replicate this with the latest 1.5.x beta? (I'm wondering if the fix exists, but never trickled back to the 1.0.x stable branch.)

ahh .... no. I generally do not load Beta software (I get into enough trouble with the fully released versions :P).
I might try in on a virtual machine though.

Where might the Beta version be found ?

The latest beta can be found on the main Arduino download page http://arduino.cc/en/Main/Software just keep scrolling down.

You can install different versions of the IDEs next to each other. I have the following installed (in these paths):
C:\Program Files (x86)\Arduino\Arduino 1.0.3
C:\Program Files (x86)\Arduino\Arduino 1.0.4
C:\Program Files (x86)\Arduino\Arduino 1.0.5
C:\Program Files (x86)\Arduino\Arduino 1.5.2
C:\Program Files (x86)\Arduino\Arduino ERW 1.0.5\

The windows versions really don't need an installer, so I just download the .zip version, extract the .zip to where I want it, and then create an appropriate shortcut on my desktop. So far it seems to work fine, but I haven't tried with any betas greater than 1.5.2 yet (I think they are up to 1.5.4r2 now). (The earlier versions are for when I find an bug or quirk with the version that I'm currently using, I can go back a few versions to try to find when the bug/quirk was introduced for bug reporting.)

I did this to myself the night before last after I had working code, and put in some print statements to clean up my output.
Finally dawned on me to CTRL-T, and immediately got the mismatched ( ) message and was able to find the typo quickly - had a ) vs a }, or the other way around.

It can even happen on code that has no errors or missing quotes.
I spent many days tracking down this error in my original code.
I have boiled it down to a very small minimal example for demonstration
and it is attached.
The comment after loop() is to add enough characters to cause the overflow.
If you reduce the number of characters in that comment it won't overflow.

It appears that the IDEs parsing code gets confused and somehow loses
track of where the quotes are since the double quote in the comment
keeps the IDE parser from crashing.
Delete that line with the commented out double quote and the IDE
parser will overflow even though the rest of the code has no errors/issues.

This is not the first time time I've been burned by the IDE failing
to parse working code correctly.

--- bill

quotecrash.pde (1.58 KB)