Page 1 of 1

Fatal compiler internal error

Posted: 27 Sep 2018 23:05
by perjar
Hi,

I am getting a compiler error all of a sudden. Appeared between two compiles without any change of the sourcecode in between.
First did a "verify" in the IDE and it worked fine. No compile or build errors.
Then clicked on "upload" to send it over to the board. Then suddenly I am getting this:

z-meter_ucxx.c:1178: error 9: FATAL Compiler Internal Error in file '/home/sdcc-builder/build/sdcc-build/orig/sdcc/src/mcs51/gen.c' line number '472' : getFreePtr should never reach here

"z-meter" is the name of my sketch.

I have uninstalled and installed the IDE but that does not change anything.

Does anyone know what the error migth mean? "internal" sounds like it has nothing to do with my sketch, but that is probably just wishful thinking. Especially since other sketches work just fine.

Re: Fatal compiler internal error

Posted: 29 Sep 2018 08:40
by PoltoS
Can you send us the Sketch?

Re: Fatal compiler internal error

Posted: 29 Sep 2018 18:52
by perjar
Hi,


Unfortunately, I have made some changes to the code so I am not getting the same error anymore. Now it is a javanullpointerexception instead.

Sending two versions of the code with the respective compiler output:

z-meter_a: No nullpointexception in this one, but I could not get around the compilation error so when I got this error output I continued with z-meter_b.

z-meter_b: The only difference from z-meter_a is that some z-uno macros are now commented away. This is where the nullpointerexcpetion happens.

I appreciate the help!
Best regards
Per

Re: Fatal compiler internal error

Posted: 30 Sep 2018 01:01
by PoltoS
z-meter_a: You had DEBUGLN((getter_power); - two ( opened and one closed ). This lead to undefined function and missing getters/resetters in channels.

But once you fix this small typo, there would be another problem that we are unable to fix currently: compiler compains on something strange. We are checking this.

Please also note that extensive usage of float is very bad on 8-bits MCU.

Also using of system functions (in your case millis) in interrupts is a very bad idea. Better to save the value of milis in the loop and save it to a variable that will be used in the ISR.

Re: Fatal compiler internal error

Posted: 02 Oct 2018 12:52
by PoltoS
PoltoS wrote:
30 Sep 2018 01:01
But once you fix this small typo, there would be another problem that we are unable to fix currently: compiler compains on something strange. We are checking this.
Interresting! This error occurs when no free registers are available during compilation. This means that your code was too heavy for this 8-bit CPU. Please minimize the usage of float and long to the minimum. In most cases you never need other than int.

Re: Fatal compiler internal error

Posted: 02 Oct 2018 14:14
by perjar
Thank you very much for the analysis and the advise!

You are perfectly right of course, I am over-using float, and it's pure laziness on my part. I will revise the code as advised.

Thanks a bunch!