Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Integer overflow



Since upgrading to version I get an integer overflow every now and then. It occurs in the TSiHash.HashOf() function in the SmartInspect unit on the ‘flushOn’ key.

When I delete all the .dcu files of my project and rebuild it the problem disappears.

I’m using SmartInspect version in combination with Delphi 7.

Any ideas?


Hello Gerben,

The HashOf function calculates an integer hash value for a given string and it can happen that intermediate integer values overflow during this operation. This is actually not a problem at all but your project seems to have the “Overflow checking” option enabled. If this option is enabled, Delphi adds additional code to detect these integer overflows and raises an exception (EIntOverflow) if such an overflow occurs.

The pre-compiled SmartInspect units do not contain code for overflow checks (since this option is for debugging only) but if you recompile the SmartInspect library from source and your project has overflow checking enabled, the additional code is added. What you can do is to safely turn off overflow checking for the SmartInspect.pas unit by adding the {$Q-} compiler directive to the beginning of the file. {$Q-} is a local compiler directive which means that this option only influences the SmartInspect.pas unit and not your entire project.

[code]unit SmartInspect;


{$I ‘’}


Alternatively to changing the source you can also compile against the pre-compiled SmartInspect units. I will make sure that the {$Q-} line is added to the next SmartInspect release.