From: SourceForge.net <no...@so...> - 2007-02-06 11:11:16
|
Patches item #1645121, was opened at 2007-01-26 10:27 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300599&aid=1645121&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Günther Jehle (jehle) Assigned to: Nobody/Anonymous (nobody) Summary: patch for bug #1273984 Initial Comment: See https://sourceforge.net/tracker/index.php?func=detail&aid=1273984&group_id=599&atid=100599 for details to the bug. In the function geniCodeSEParms gets the parameters converted to OPERANDs. The operands should have the same type as the original parameter. But if the parameter is an assignment, the function ast2iCode returns the right symbol. And the right symbol could have another type as the parameter. The solution: Check if the parameter and the operand have different types. If they have, add a cast. ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2007-02-06 12:11 Message: Logged In: YES user_id=888171 Originator: NO I don't think that a cast is the correct fix. It seems like the right side of the assignment is passed as the parameter where it should use the left side. Consider the following: int a = 10; bool b; void foo(int, int); foo(a, b=a); IMO this should pass int 1 [ (int)(bool)(int 10) ] and not int 10 (no cast according to your rules). NB: There is an mcs51-small-stack-auto regression test that is run by default and there is even an mcs51-small-xstack-auto you could run. The mcs51 target only passes the first (non-bool) parameter by registers. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2007-02-06 11:40 Message: Logged In: NO Hi Borut, the problem is, that the failure is only reproducible when the parameters in a function call are passed on the stack (with --stack-auto or a platform like z80 which passes parameters on stack). When they are passed in registers or global ram locations, the failure will not occur. Currently it is not possible to pass a option for a regression test, so it is not possible to use the --stack-auto flag for all platforms. Regards Günther ---------------------------------------------------------------------- Comment By: Borut Razem (borutr) Date: 2007-02-03 15:54 Message: Logged In: YES user_id=568035 Originator: NO Günther, the attached regression test doesn't fail on ds390 and mcs51-large platforms (using no patched SDCC). Since you provided a patch which is target independent, you should prove that the bug exists on all targets. Could be this done by adding two additional dummy char parameters: one before and the other after "val", for example: ... void fooInt(char pre, {sign} int val, char post) { ASSERT(pre==0x55); ASSERT(val==3); ASSERT(val==0x55); } ... testAssignInFunctioncall(void) { ... fooInt(0x55, intVal=charVal, 0x55); ... ? I haven't tried it yet... Borut ---------------------------------------------------------------------- Comment By: Günther Jehle (jehle) Date: 2007-01-26 10:34 Message: Logged In: YES user_id=1301993 Originator: YES File Added: bug-1273984.c ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300599&aid=1645121&group_id=599 |