From: SourceForge.net <no...@so...> - 2003-03-10 12:38:49
|
Bugs item #700121, was opened at 2003-03-08 23:52 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=700121&group_id=599 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Frieder Ferlemann (frief) Assigned to: Nobody/Anonymous (nobody) Summary: sdcc does not clear high byte here Initial Comment: // The code does not make much sense, but the result is not OK. // hl_byte doesn't clear high byte. // Recent cvs. Generated .asm is appended. (z80 looks similar). unsigned int hl_byte(unsigned int i) { i = 0xabcd; i&= 0x00ff; return i; } main() { while( 0x00cd != hl_byte(0x1234) ) ; } #if 0 ;test.c:5: unsigned int hl_byte(unsigned int i) ; ----------------------------------------- ; function hl_byte ; ----------------------------------------- _hl_byte: ;test.c:9: return i; ; genRet mov dpl,#0xCD 00101$: ret #endif ---------------------------------------------------------------------- Comment By: Jan Rejlek (jare) Date: 2003-03-10 13:49 Message: Logged In: YES user_id=672939 I think that this is completely O.K., because the arguments in C are passed by value ind therefore the function cannot change the argument in the calling function. Regards, Jan Rejlek ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=700121&group_id=599 |