[fpc-pascal] Warning: Type size mismatch, possible loss of data / range check error

Peter peter at pblackman.plus.com
Thu Jun 18 17:37:25 CEST 2015


Hi Everybody,

I tried compiling with all warnings for a final polish/check on a
project, and seem to be getting a raft of false positives.
The following example stub gives two warnings;

Program test;

Const TAB = Char(Chr(9));

Var A : DWord;

Begin
A := 0;
End.


Also I get the same warning on every 'SetLength' with a constant param,
and on every 'New' statement. Zillions of them in total, which makes it
very hard to see any genuine issues. (I did have a few, mixing
signed/unsigned).

The problem occurs with BOTH switches -Cr & -CO
Any one of these, and the compiler is silent,
Is this a bug? Surely, the above A:=0; is valid Pascal isn’t it?

Regards,
Peter



More information about the fpc-pascal mailing list