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->mBits = mBits;
ndec->mShift = mShift;
ndec->mFlags = mFlags | DTF_CONST;
ndec->mFlags = mFlags & ~DTF_CONST;
ndec->mScope = mScope;
ndec->mParams = mParams;
ndec->mIdent = mIdent;

View File

@ -53089,7 +53089,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerExits(int pass)
mIns[sz - 3] = mIns[sz - 1];
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 (mBranch == ASMIT_BCC)
mBranch = ASMIT_BPL;

View File

@ -8973,7 +8973,7 @@ Expression* Parser::ParseAddExpression(bool lhs)
if (mCompilerOptions & COPT_CPLUSPLUS)
mErrors->Error(mScanner->mLocation, ERRR_INVALID_VOID_POINTER_ARITHMETIC, "Invalid arithmetic on void pointer");
else
mErrors->Error(mScanner->mLocation, EWARN_INVALID_VOID_POINTER_ARITHMETIC, "Invalid arithmetic on void pointer");
mErrors->Error(mScanner->mLocation, EWARN_INVALID_VOID_POINTER_ARITHMETIC, "Invalid arithmetic on void pointer");
}
nexp->mDecType = nexp->mLeft->mDecType;
}
@ -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)
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
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)
{
mFunctionType->mBase = mFunctionType->mBase->DeduceAuto(exp->mLeft->mDecType);
;
if (mFunctionType->mBase->mType == DT_TYPE_STRUCT)
{
// Make room for value struct return