Incosistent behaviour of {$warnings on/off}
Original Reporter info from Mantis: Adriaan van Os
-
Reporter name: Adriaan van Os
Original Reporter info from Mantis: Adriaan van Os
- Reporter name: Adriaan van Os
Description:
In the following program
{$mode macpas}
program nowarnings;
var
p: Pointer;
offs: PtrInt;
a: array[ 1..100] of integer;
begin
{$warnings on}
p:= @a;
offs:= SizeOf(integer);
PtrUInt(p):=PtrUInt(p) + offs;
PtrInt(p):=PtrInt(p) + offs;
{$warnings off}
PtrUInt(p):=PtrUInt(p) + offs;
PtrInt(p):=PtrInt(p) + offs;
{$warnings on}
end.
the directive {warnings off} suppresses the warning for line 14, but not the warning for line 15. Also, the result is different if the last {
warnings on} line is omitted, as in the following program
{$mode macpas}
program nowarnings;
var
p: Pointer;
offs: PtrInt;
a: array[ 1..100] of integer;
begin
{$warnings on}
p:= @a;
offs:= SizeOf(integer);
PtrUInt(p):=PtrUInt(p) + offs;
PtrInt(p):=PtrInt(p) + offs;
{$warnings off}
PtrUInt(p):=PtrUInt(p) + offs;
PtrInt(p):=PtrInt(p) + offs;
end.
Additional information:
fpc trunk revision 11708
Mantis conversion info:
- Mantis ID: 12076
- Version: 2.3.1
- Fixed in version: 2.4.0
- Fixed in revision: 12025 (#e5920bc2)
- Target version: 2.4.0