 RE: Possbile bug with C51 compiler for T89C51RD2 target Simon Barchard Hi, Compiler: WarningLevel = 2 (max warninging level as far as I can tell) Linker: No warnings have been disabled. Build output has 12 identical warnings: SOCKET.C(213): warning C182: pointer to different objects The culprit of which is a function that recieves a char argument, and does the following:
//declarations
u_char xdata* src2
long xdata* src2_long;
func()
{
src2_long = src2;
dst_long = dst;
}
I can eliminate the warnings by making a type cast:
src2_long = (long xdata*)src2;
dst_long = (long xdata*)dst;
...but I'll have to read the compiler manual to be sure what the effect of the cast is (as I don't know enough about 8051/Keil and xdata types, yet). Testing the type casted code on the system did not fix the underlying problem that causes the system to hang. Optimization I've been changing the optimization and have the following results: OPTIMIZATION_LEVEL = 5 compiles with no warnings OPTIMIZATION = 4 (resigter variables) compiling SOCKET.C... SOCKET.C(168): error C253: INTERNAL ERROR (ASMGEN - TRIPLE=0FB[00961289]) SOCKET.C(168): error C253: INTERNAL ERROR (ASMGEN - TRIPLE=103[00961421]) compiling dolphin_utils.c... compiling memory_mapping.c... compiling MAIN.C... compiling startup_utils.c... Target not created The code refered to is:
send_ptr = (u_char *)(SBUFBASEADDRESS[s] + (UINT)(wr_ptr.lVal & SMASK[s]));
Keil Error description: This error can occur under the following circumstances: An intrinsic function (for example, _testbit_) was activated incorrectly. This is the case when no prototype of the function exists and the number of actual parameters or their type is incorr --->this doesn't make sense to me in this context. OPTIMIZATION = 2 & 3 *** WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?_PUTBYTE?SERIAL CALLER1: ?PR?TIMER0_ISR?DOLPHIN_UTILS CALLER2: ?C_C51STARTUP 1. Is it not strange that the ERROR I get with optimization = 4, does not appear with optimization = 2 or 3? 2. Could the bug have anything to do with the warning for optimization levels 2&3...i.e. a code re-entrancy problem. This is my best guess at the moment, so my strategy is to keep optimization to a minimum and continue. Thanks for the help. |