blob: 3fa76fc504021bbe705c757d9d79f9c87f555feb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
program overflowbug;
{$mode objfpc}{$Q+}
const
zero=0;
one=1;
var
x,y,z: cardinal;
begin
x := 0;
y := one + x;
// the next line sets the carry flag, so a overflow error will be generated
if x>y then;
// here the overflow error will be generated.
// the addition of zero is optimized away, but the check for the carry flag
// is not removed, so it is using the result of the compile in line 17
z := zero + y;
end.
|