I have encountered an internal compiler error when compiling a particular bit of code for the 8051 (mcs51) using the large memory model and a re-entrant function.
If the small memory model is used or if the function is made non-reentrant, then it compiles successfully (although the generated code is incorrect! I will post separately about the code generation error). However, this particular re-entrant function has no local variables, parameters, or return value. I think that SDCC is, however, creating a temporary stack variable for the value of the "(now - updated)" expression, and perhaps it is confused since SDCC thought it was not going to require storage for any local variables. Compiler Error ============== $ ~/bin/sdcc/bin/sdcc -mmcs51 -c --model-small bad.c $ ~/bin/sdcc/bin/sdcc -mmcs51 -c --model-large bad.c bad.c:16: error 9: FATAL Compiler Internal Error in file 'gen.c' line number '441' : getFreePtr should never reach here Contact Author with source code SDCC version ============ I am using SDCC svn revision 5287, though I also tested rev 5252, which also exhibits the same error. $ ~/bin/sdcc/bin/sdcc --version SDCC : mcs51 2.8.4 #5287 (Dec 16 2008) (UNIX) Source Code (bad.c) =================== ------------------------------------------------------------ #include <stdint.h> uint32_t sleep_timer_get(void); int32_t remaining; uint32_t updated; uint32_t now; static void do_test(void) __reentrant { while (1) { now = sleep_timer_get(); remaining -= (now - updated) & 0xFF; updated = now; } } ------------------------------------------------------------ Regards, Colin
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user