tb0427.pp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {$MODE objFPC}
  2. unit tb0427;
  3. // Purpose: Demonstrate Internal Error #10
  4. //
  5. // Version: Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
  6. // Copyright (c) 1993-2002 by Florian Klaempfl
  7. //
  8. // Compiler Output:
  9. // Free pascal Compiler version 1.0.6 [2002/04/23] for i386
  10. // Copyright (c) 1993-2002 by Florian Klaempfl
  11. // Target OS: Win32 for i386
  12. // Compiling c:\windows\desktop\files\projects\sageapi\t.pas
  13. // t.pas(68,51) Fatal: Internal error 10
  14. //
  15. // Bug Contributor:
  16. // Jason Sage
  17. // [email protected]
  18. //
  19. // Date Contributed: 2002-12-01
  20. // System OS: MS Windows ME v4.90.3000
  21. // System: Compaq, Genuine Intel, Intel(r) Celeron(tm) processor
  22. // 63.0MB Ram
  23. //
  24. interface
  25. implementation
  26. type TClass = class
  27. protected
  28. VBuf: ^word;
  29. public
  30. constructor Init;
  31. destructor Done;
  32. procedure Test(p_dwNewWidth, p_dwNewHeight: Cardinal);
  33. end;
  34. var
  35. MyClass: TClass;
  36. constructor TClass.Init; begin GetMem(VBuf,2); end;
  37. destructor TClass.Done; begin freemem(VBuf); end;
  38. procedure TClass.Test(p_dwNewWidth, p_dwNewHeight: Cardinal);
  39. var
  40. OldVBuf: ^word;
  41. t,s: Cardinal;
  42. w,h: Cardinal; // preserve Width and Height of VC
  43. wData: word;
  44. begin
  45. getmem(OldVBuf,1); freemem(OldVBuf); // shutoff hint
  46. w:=w; h:=h; // shut off hint
  47. OldVBuf:=VBuf;
  48. GetMem(VBuf, p_dwNewWidth * p_dwNewHeight * 2);
  49. for t:=1 to W do // won't cause error if you do this the more efficient
  50. begin // way: for t:=0 to W-1 do
  51. for s:=1 to H do// for s:=0 to H-1 do
  52. begin // and replace the [(t-1)+((s-1)*W)] logic to [t+s*w]
  53. if (t<=p_dwNewWidth) and (s<=p_dwNewHeight) then
  54. begin
  55. {
  56. // This is the work around that I used in my UNIT and the code Works
  57. wData:=OldVBuf[(t-1)+(s-1)*H];
  58. VBuf[(t-1)+((s-1)*p_dwNewWidth)]:=wData;
  59. }
  60. // This way causes an Internal Error 10 from the compiler.
  61. VBuf[(t-1)+((s-1)*p_dwNewWidth)]:=OldVBuf[(t-1)+(s-1)*H];
  62. end;
  63. end;
  64. end;
  65. Freemem(OldVBuf);
  66. end;
  67. begin
  68. MyClass:=TClass.Init;
  69. MyClass.Test(1,1);
  70. MyClass.Done;
  71. end.