Loading libacc/acc.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -4891,11 +4891,15 @@ class Compiler : public ErrorSink { int argCount = 0; for (Type* pP = pDecl->pTail; pP; pP = pP->pTail) { Type* pArg = pP->pHead; if (pArg->id) { addLocalSymbol(pArg); } /* read param name and compute offset */ size_t alignment = pGen->stackAlignmentOf(pArg); a = (a + alignment - 1) & ~ (alignment-1); if (pArg->id) { VI(pArg->id)->pAddress = (void*) a; } a = a + pGen->stackSizeOf(pArg); argCount++; } Loading libacc/tests/data/funcargs.c 0 → 100644 +8 −0 Original line number Diff line number Diff line int f(int a,int, int c) { return a + c; } int main() { return f(1,2,3); } libacc/tests/test.py +5 −0 Original line number Diff line number Diff line Loading @@ -437,6 +437,11 @@ result: 0 def testDefines(self): self.compileCheck(["-R", "data/defines.c"], """Executing compiled code: result: 3 ""","""""") def testFuncArgs(self): self.compileCheck(["-R", "data/funcargs.c"], """Executing compiled code: result: 4 ""","""""") def main(): Loading Loading
libacc/acc.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -4891,11 +4891,15 @@ class Compiler : public ErrorSink { int argCount = 0; for (Type* pP = pDecl->pTail; pP; pP = pP->pTail) { Type* pArg = pP->pHead; if (pArg->id) { addLocalSymbol(pArg); } /* read param name and compute offset */ size_t alignment = pGen->stackAlignmentOf(pArg); a = (a + alignment - 1) & ~ (alignment-1); if (pArg->id) { VI(pArg->id)->pAddress = (void*) a; } a = a + pGen->stackSizeOf(pArg); argCount++; } Loading
libacc/tests/data/funcargs.c 0 → 100644 +8 −0 Original line number Diff line number Diff line int f(int a,int, int c) { return a + c; } int main() { return f(1,2,3); }
libacc/tests/test.py +5 −0 Original line number Diff line number Diff line Loading @@ -437,6 +437,11 @@ result: 0 def testDefines(self): self.compileCheck(["-R", "data/defines.c"], """Executing compiled code: result: 3 ""","""""") def testFuncArgs(self): self.compileCheck(["-R", "data/funcargs.c"], """Executing compiled code: result: 4 ""","""""") def main(): Loading