Fixed UltraSPARC II bus error. Probably a compiler bug?

Issue #65


git-svn-id: http://picoc.googlecode.com/svn/trunk@385 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-11-07 15:17:53 +00:00
parent 3377c3b568
commit e077cc9d49
2 changed files with 4 additions and 3 deletions

View file

@ -1192,9 +1192,10 @@ void ExpressionParseFunctionCall(struct ParseState *Parser, struct ExpressionSta
if (FuncValue->Val->FuncDef.Intrinsic == NULL)
{
/* run a user-defined function */
struct ParseState FuncParser = FuncValue->Val->FuncDef.Body;
struct ParseState FuncParser;
int Count;
memcpy((void *)&FuncParser, (void *)&FuncValue->Val->FuncDef.Body, sizeof(struct ParseState));
VariableStackFrameAdd(Parser, FuncValue->Val->FuncDef.Intrinsic ? FuncValue->Val->FuncDef.NumParams : 0);
TopStackFrame->NumParams = ArgCount;
TopStackFrame->ReturnValue = ReturnValue;

View file

@ -88,8 +88,8 @@ void *VariableAlloc(struct ParseState *Parser, int Size, int OnHeap)
/* allocate a value either on the heap or the stack using space dependent on what type we want */
struct Value *VariableAllocValueAndData(struct ParseState *Parser, int DataSize, int IsLValue, struct Value *LValueFrom, int OnHeap)
{
struct Value *NewValue = VariableAlloc(Parser, sizeof(struct Value) + DataSize, OnHeap);
NewValue->Val = (union AnyValue *)((char *)NewValue + sizeof(struct Value));
struct Value *NewValue = VariableAlloc(Parser, MEM_ALIGN(sizeof(struct Value)) + DataSize, OnHeap);
NewValue->Val = (union AnyValue *)((char *)NewValue + MEM_ALIGN(sizeof(struct Value)));
NewValue->ValOnHeap = OnHeap;
NewValue->ValOnStack = !OnHeap;
NewValue->IsLValue = IsLValue;