(Unreplicable) Internal error 200109092 when accessing enum-range-specified array
Original Reporter info from Mantis: etrusco
-
Reporter name: Flávio Etrusco
Original Reporter info from Mantis: etrusco
- Reporter name: Flávio Etrusco
Description:
I'm reporting this bug just in case there's any interest in fixing it. It's very obscure and AFAICS from the code the 200109092 is very generic...
I found it while making a change in Lazarus, but that I can't replicate in a smaller test-case, and it doesn't even occur when compiling from the command-line! (I'd guess it must be caused by a compiler flag, but the package - LCLBase - doesn't use any special flag, just -O1, and the test-case doesn't trigger the error no matter what flags I use)
Running inside Lazarus I get:
(...)\lcl\controls.pp(3122,18) Error: range check error while evaluating constants
(...)\lcl\controls.pp(3122,33) Error: range check error while evaluating constants
(...)\lcl\controls.pp(3122,11) Fatal: Internal error 200109092
The problem occurs in the following code:
function TControlBorderSpacing.IsEqual(Spacing: TControlBorderSpacing
): boolean;
begin
Result:=(FAround=Spacing.Around)
and (FSides[akLeft]=Spacing.FSides[akLeft])
and (FSides[akTop]=Spacing.FSides[akTop])
and (FSides[akBottom]=Spacing.FSides[akBottom])
and (FSides[akRight]=Spacing.FSides[akRight]);
end;
The types:
TSpacingSize = 0..MaxInt;
(...)
TControlBorderSpacing = class(TPersistent)
(...)
FSides: array [akLeft..akBottom] of TSpacingSize;
(...)
end;
If I declare FSides using TAnchorKind instead of the range (akLeft..akBottom) the error is gone.
BorderSpacing-refactor-r32343.patch is a working change needed to apply the buggy patch.
BorderSpacing-refactor-bug-r32343.patch contains only the TAnchorKind -> akLeft..akBottom changes that trigger the bug.
FWIW I'll attach the starting test project (that doesn't trigger the bug).
Mantis conversion info:
- Mantis ID: 20251
- OS: win32
- OS Build: Windows 7 32-bit
- Platform: i386
- Version: 2.4.4