Fix bit field member naming and placement

This commit is contained in:
drmortalwombat 2024-09-17 09:19:16 +02:00
parent aae7d81cc6
commit 4886d0194f
2 changed files with 34 additions and 7 deletions

View File

@ -8985,6 +8985,9 @@ void InterCodeBasicBlock::UpdateLocalIntegerRangeSets(const GrowingVariableArray
case IA_CMPGU: case IA_CMPGU:
if (s1 >= 0) if (s1 >= 0)
{ {
if (mInstructions[sz - 2]->mSrc[1].mRange.mMinState == IntegerValueRange::S_BOUND && mInstructions[sz - 2]->mSrc[1].mRange.mMinValue < 0)
mTrueValueRange[s1].mMaxState = IntegerValueRange::S_UNBOUND;
mTrueValueRange[s1].LimitMin(1); mTrueValueRange[s1].LimitMin(1);
if (s0 < 0) if (s0 < 0)
{ {
@ -22006,7 +22009,7 @@ void InterCodeProcedure::Close(void)
{ {
GrowingTypeArray tstack(IT_NONE); GrowingTypeArray tstack(IT_NONE);
CheckFunc = !strcmp(mIdent->mString, "main"); CheckFunc = !strcmp(mIdent->mString, "e1");
CheckCase = false; CheckCase = false;
mEntryBlock = mBlocks[0]; mEntryBlock = mBlocks[0];

View File

@ -412,10 +412,17 @@ Declaration* Parser::ParseStructDeclaration(uint64 flags, DecType dt, Declaratio
bitsleft = bitsleft + 8 - mdec->mBits; bitsleft = bitsleft + 8 - mdec->mBits;
offset++; offset++;
} }
else if (mdec->mOffset >= 2)
{
mdec->mOffset -= 2;
mdec->mShift = 16 - bitsleft;
bitsleft = bitsleft + 16 - mdec->mBits;
offset += 2;
}
else else
{ {
mdec->mOffset -= 3; mdec->mOffset--;
mdec->mShift = 24 - bitsleft; mdec->mShift = 8 - bitsleft;
bitsleft = bitsleft + 16 - mdec->mBits; bitsleft = bitsleft + 16 - mdec->mBits;
offset += 2; offset += 2;
} }
@ -428,15 +435,32 @@ Declaration* Parser::ParseStructDeclaration(uint64 flags, DecType dt, Declaratio
offset += 3; offset += 3;
} }
else if (bitsleft + 16 >= mdec->mBits) else if (bitsleft + 16 >= mdec->mBits)
{
if (mdec->mOffset >= 2)
{
mdec->mOffset -= 2;
mdec->mShift = 16 - bitsleft;
bitsleft = bitsleft + 16 - mdec->mBits;
offset += 2;
}
else
{
mdec->mOffset--;
mdec->mShift = 8 - bitsleft;
bitsleft = bitsleft + 16 - mdec->mBits;
offset += 2;
}
}
else if (mdec->mOffset >= 2)
{ {
mdec->mOffset -= 2; mdec->mOffset -= 2;
mdec->mShift = 16 - bitsleft; mdec->mShift = 16 - bitsleft;
bitsleft = bitsleft + 16 - mdec->mBits; bitsleft = bitsleft + 24 - mdec->mBits;
offset += 2; offset += 3;
} }
else else
{ {
mdec->mOffset -= 1; mdec->mOffset--;
mdec->mShift = 8 - bitsleft; mdec->mShift = 8 - bitsleft;
bitsleft = bitsleft + 24 - mdec->mBits; bitsleft = bitsleft + 24 - mdec->mBits;
offset += 3; offset += 3;
@ -6284,7 +6308,7 @@ Expression* Parser::ParseSimpleExpression(bool lhs, bool tid)
Declaration* Parser::MemberLookup(Declaration* dtype, const Ident* ident, int & offset, uint64& flags) Declaration* Parser::MemberLookup(Declaration* dtype, const Ident* ident, int & offset, uint64& flags)
{ {
if (ident == dtype->mIdent) if ((mCompilerOptions & COPT_CPLUSPLUS) && ident == dtype->mIdent)
return nullptr; return nullptr;
Declaration* mdec = dtype->mScope->Lookup(ident, SLEVEL_CLASS); Declaration* mdec = dtype->mScope->Lookup(ident, SLEVEL_CLASS);