Warnings W1071 and W1072: Implicit integer cast ... / Implicit conversion may lose ...
When compile the FatMM5.pas with "implicit integer warnings" ON,
dproj:
<DCC_COMBINING_SIGNED_UNSIGNED64>true</DCC_COMBINING_SIGNED_UNSIGNED64>
<DCC_IMPLICIT_CONVERSION_LOSS>true</DCC_IMPLICIT_CONVERSION_LOSS>
<DCC_IMPLICIT_INTEGER_CAST_LOSS>true</DCC_IMPLICIT_INTEGER_CAST_LOSS>
There are multiple warnings (32 and 64 bit), most of them look innocent, but just to be on the safe side please review:
[dcc64 Warning] FastMM5.pas(2528): W1072 Implicit conversion may lose significant digits from 'unsigned 64-bit integer' to 'Cardinal'
[dcc64 Warning] FastMM5.pas(2597): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Integer'
[dcc64 Warning] FastMM5.pas(2741): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Integer'
[dcc64 Warning] FastMM5.pas(3067): W1071 Implicit integer cast with potential data loss from 'UInt64' to 'signed 32-bit integer'
[dcc64 Warning] FastMM5.pas(3323): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3325): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3327): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3332): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3337): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3352): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3357): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3362): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3432): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Integer'
[dcc64 Warning] FastMM5.pas(3909): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(3924): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(4761): W1072 Implicit conversion may lose significant digits from 'unsigned 64-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(4801): W1072 Implicit conversion may lose significant digits from 'signed 32-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(4875): W1072 Implicit conversion may lose significant digits from 'unsigned 64-bit integer' to 'Cardinal'
[dcc64 Warning] FastMM5.pas(5138): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Integer'
[dcc64 Warning] FastMM5.pas(6142): W1072 Implicit conversion may lose significant digits from 'Int64' to 'Integer'
[dcc64 Warning] FastMM5.pas(6149): W1072 Implicit conversion may lose significant digits from 'Int64' to 'Integer'
[dcc64 Warning] FastMM5.pas(6153): W1072 Implicit conversion may lose significant digits from 'Int64' to 'Integer'
[dcc64 Warning] FastMM5.pas(6217): W1072 Implicit conversion may lose significant digits from 'Int64' to 'Integer'
[dcc64 Warning] FastMM5.pas(6223): W1072 Implicit conversion may lose significant digits from 'Int64' to 'Integer'
[dcc64 Warning] FastMM5.pas(6295): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(6301): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(6312): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(6318): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Word'
[dcc64 Warning] FastMM5.pas(8240): W1072 Implicit conversion may lose significant digits from 'Integer' to 'Byte'
[dcc64 Warning] FastMM5.pas(8281): W1072 Implicit conversion may lose significant digits from 'Integer' to 'Byte'
[dcc64 Warning] FastMM5.pas(8339): W1072 Implicit conversion may lose significant digits from 'Integer' to 'Byte'
[dcc64 Warning] FastMM5.pas(8423): W1072 Implicit conversion may lose significant digits from 'Integer' to 'Byte'
[dcc64 Warning] FastMM5.pas(8475): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Byte'
[dcc64 Warning] FastMM5.pas(8932): W1071 Implicit integer cast with potential data loss from 'signed 64-bit integer' to 'UInt64'
[dcc64 Warning] FastMM5.pas(9304): W1072 Implicit conversion may lose significant digits from 'signed 64-bit integer' to 'Integer'
[dcc64 Warning] FastMM5.pas(9644): W1072 Implicit conversion may lose significant digits from 'Integer' to 'Byte'
[dcc64 Warning] FastMM5.pas(9893): W1072 Implicit conversion may lose significant digits from 'Integer' to 'Word'
Thank you, Pavel (BroadView Software)
Hi Pavel,
Thank you for reporting. I have checked all the warnings, and they are all false alarms. However, I have gone ahead and made the typecasts explicit so that the warnings will no longer be reported.
Best regards, Pierre
Thank you Pierre! Best Regards, Pavel
Hi Pierre
There is one more of these at line 8786:
AMemoryManagerState.SmallBlockTypeStates[i].UseableBlockSize := SmallBlockManagers[0][i].BlockSize - CSmallBlockHeaderSize;
It seems the result of subtracting a constant number from a Word/Cardinal is always an integer, and so the warning. I think it is safe to put Cardinal(...) round the whole of the right-hand-side or simply mark it as OK using the $WARN directives. I don't know which you prefer
Regards, Stuart