diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index 866d429..cbae647 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -732,6 +732,13 @@ Expression* Expression::ConstantFold(Errors * errors, LinkerSection * dataSectio ex->mDecType = mDecType; return ex; } + else if (mLeft->mDecValue->mType == DT_CONST_POINTER) + { + Expression* ex = new Expression(mLocation, EX_CONSTANT); + ex->mDecValue = mLeft->mDecValue; + ex->mDecType = mDecType; + return ex; + } } else if (mDecType->mType == DT_TYPE_INTEGER) { diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index 359c325..c201d50 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -1510,6 +1510,8 @@ Declaration * Parser::CopyConstantInitializer(int offset, Declaration* dtype, Ex exp = CoerceExpression(exp, dtype); + exp = exp->ConstantFold(mErrors, mDataSection); + Declaration* dec = exp->mDecValue; if (exp->mType == EX_CONSTANT)