From what I can tell, it gives this error when you try to allocate too much memory to one section.
I have no idea how much memory one section can use, or even what one section is, but if you stick stuff into rom or use smaller types, you can probably get rid of this error.
You can also try giving the "-mL" argument to C18 to tell it to use more memory.
I don't believe operations of any sort contribute to the problem, as that is all stored in rom.
Changing the two longs to ints would reduce the amount of ram it needed. Even though they are local, they have to go somewhere when other local variables are still in scope.
You can use "rom" like a variable modifier.
Code:
rom static variable;
I'm quite suprised "const" doesn't put stuff in rom, and I would expect that "rom" makes data unchangeable just like "const".