You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
davezarzycki opened this issue
Jun 20, 2018
· 3 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfIRGenLLVM IR generation
FixedTypeInfo::getSpareBitExtraInhabitantCount() is broken. You can see an example of the brokenness in test/IRGen/enum.sil, where the following type exists:
The size of the above type should be 65 bits, but the current compiler wrongly thinks that 64 bits are good enough. The fix is as follows:
diff --giti/lib/IRGen/GenType.cppw/lib/IRGen/GenType.cppindexffdadb8fca..0954d60227100644
--- i/lib/IRGen/GenType.cpp
+++ w/lib/IRGen/GenType.cpp@@ -239,13 +239,10@@unsignedFixedTypeInfo::getSpareBitExtraInhabitantCount() const {
return0;
// The runtime supports a max of 0x7FFFFFFF extra inhabitants, which ought// to be enough for anybody.
- if (getFixedSize().getValue() >= 4)
- return0x7FFFFFFF;
- unsignedspareBitCount = SpareBits.count();
+ autospareBitCount = std::min(SpareBits.count(), 31ul);
assert(spareBitCount <= getFixedSize().getValueInBits()
&& "more spare bits than storage bits?!");
- unsignedinhabitedBitCount = getFixedSize().getValueInBits() - spareBitCount;
- return ((1U << spareBitCount) - 1U) << inhabitedBitCount;
+ return ((1U << spareBitCount) - 1U);
}
I would have created a pull request, but I got bogged down in updating the test file and I wasn't sure if people would prefer that the 'z' case be removed at the same time as one deals with the fallout from the code change. Thoughts? This isn't urgent for me, so if somebody wants to power through the minor test suite fallout, I'd really appreciate it.
The text was updated successfully, but these errors were encountered:
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfIRGenLLVM IR generation
Additional Detail from JIRA
md5: cec19f0c0620dadabe28263b8449e140
Issue Description:
FixedTypeInfo::getSpareBitExtraInhabitantCount() is broken. You can see an example of the brokenness in test/IRGen/enum.sil, where the following type exists:
The size of the above type should be 65 bits, but the current compiler wrongly thinks that 64 bits are good enough. The fix is as follows:
I would have created a pull request, but I got bogged down in updating the test file and I wasn't sure if people would prefer that the 'z' case be removed at the same time as one deals with the fallout from the code change. Thoughts? This isn't urgent for me, so if somebody wants to power through the minor test suite fallout, I'd really appreciate it.
The text was updated successfully, but these errors were encountered: