Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Execution    [ Add a report in this area ]  
Report #:  78161   Status: Open
[DCC Fatal Error] F2084 Internal Error: C1812
Project:  Delphi Build #:  12.0.3420.21218
Version:    12.3 Submitted By:   Mitja Perko
Report Type:  Crash / Data loss / Total failure Date Reported:  9/28/2009 7:59:13 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   273100
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
There seem to be a bug in compiler. It is present since Delphi 7. Workaround is quite simple by adding an extra line to the loops. But still... It should work.

It seems if you remove one loop or do this in a procedure and not constructor that it compiles just fine.
Steps to Reproduce:
Compile this code:

type TTest=class
  c:array[0..2,0..1] of Double;
  constructor X;
end;

constructor TTest.X;
var i,j:integer;
const
  c1:array[0..2,0..1] of Double=((0,1),(1,2),(1,1.05));
begin
  for i := 0 to 3*2-1 do
  begin
//    j:=i div 3; // this can prevent internal error
    c[i mod 3,i div 3]:=c1[i mod 3,i div 3];
  end;
  for i := 0 to 3*3-1 do
  begin
//    j:=i div 3; // this can prevent internal error
    c[i mod 3,i div 3]:=c1[i mod 3,i div 3];
  end;
end;
Workarounds
Remove the commented lines (=add extra work to the loop). Although this raises hints.
Attachment
None
Comments

None

Server Response from: ETNACODE01