Fix internal const cast

This commit is contained in:
drmortalwombat 2025-05-04 16:00:08 +02:00
parent f99abb32e2
commit f43f471124
3 changed files with 8 additions and 4 deletions

View File

@ -2428,7 +2428,7 @@ Declaration* Declaration::ToMutableType(void)
ndec->mBase = mBase; ndec->mBase = mBase;
ndec->mBits = mBits; ndec->mBits = mBits;
ndec->mShift = mShift; ndec->mShift = mShift;
ndec->mFlags = mFlags | DTF_CONST; ndec->mFlags = mFlags & ~DTF_CONST;
ndec->mScope = mScope; ndec->mScope = mScope;
ndec->mParams = mParams; ndec->mParams = mParams;
ndec->mIdent = mIdent; ndec->mIdent = mIdent;

View File

@ -53089,7 +53089,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerExits(int pass)
mIns[sz - 3] = mIns[sz - 1]; mIns[sz - 3] = mIns[sz - 1];
mIns[sz - 1].mType = ASMIT_NOP; mIns[sz - 1].mMode = ASMIM_IMPLIED; mIns[sz - 1].mType = ASMIT_NOP; mIns[sz - 1].mMode = ASMIM_IMPLIED;
mIns[sz - 2].mLive |= LIVE_CPU_REG_Z; mIns[sz - 2].mLive |= LIVE_CPU_REG_Z | LIVE_CPU_REG_X;
if (mIns[sz - 2].ReferencesYReg()) mIns[sz - 3].mLive |= LIVE_CPU_REG_Y; if (mIns[sz - 2].ReferencesYReg()) mIns[sz - 3].mLive |= LIVE_CPU_REG_Y;
if (mBranch == ASMIT_BCC) if (mBranch == ASMIT_BCC)
mBranch = ASMIT_BPL; mBranch = ASMIT_BPL;

View File

@ -9010,6 +9010,10 @@ Expression* Parser::ParseAddExpression(bool lhs)
} }
else if (nexp->mLeft->mDecType->mType == DT_TYPE_FLOAT || nexp->mRight->mDecType->mType == DT_TYPE_FLOAT) else if (nexp->mLeft->mDecType->mType == DT_TYPE_FLOAT || nexp->mRight->mDecType->mType == DT_TYPE_FLOAT)
nexp->mDecType = TheFloatTypeDeclaration; nexp->mDecType = TheFloatTypeDeclaration;
else if (nexp->mToken == TK_SUB &&
(nexp->mLeft->mDecType->mType == DT_TYPE_POINTER || nexp->mLeft->mDecType->mType == DT_TYPE_ARRAY) &&
(nexp->mRight->mDecType->mType == DT_TYPE_POINTER || nexp->mRight->mDecType->mType == DT_TYPE_ARRAY))
nexp->mDecType = TheSignedIntTypeDeclaration;
else else
nexp->mDecType = exp->mDecType; nexp->mDecType = exp->mDecType;
@ -10710,7 +10714,7 @@ Expression* Parser::ParseStatement(void)
if (mFunctionType->mBase->mType == DT_TYPE_AUTO || mFunctionType->mBase->IsReference() && mFunctionType->mBase->mBase->mType == DT_TYPE_AUTO) if (mFunctionType->mBase->mType == DT_TYPE_AUTO || mFunctionType->mBase->IsReference() && mFunctionType->mBase->mBase->mType == DT_TYPE_AUTO)
{ {
mFunctionType->mBase = mFunctionType->mBase->DeduceAuto(exp->mLeft->mDecType); mFunctionType->mBase = mFunctionType->mBase->DeduceAuto(exp->mLeft->mDecType);
;
if (mFunctionType->mBase->mType == DT_TYPE_STRUCT) if (mFunctionType->mBase->mType == DT_TYPE_STRUCT)
{ {
// Make room for value struct return // Make room for value struct return