[fpc-devel] Error: Data element too large / Compilation aborted .. unhandled exception .. AV

Hans-Peter Suter gchappi at gmail.com
Wed Mar 15 22:36:53 CET 2017


Goedenavond,

The following snippet gives the above mentioned error message on Mac
(Yosem.) and aborts the compilation process on Ubuntu (14.04). I'm
using version 3.0.2 [2017/02/12] for i386 and 3.0.2 [2017/02/25] for
x86_64. There are several variants (mentioned in code) which influence the
outcome. Code is from a low-level header file which I likely won't ever
need but I thought it might be of interest nevertheless.

Hans-Peter

PS: in case this should go to Tracker/Mantis? could this do someone, maybe?
(otherwise let me know, thanks).

```pascal (file saved as a.pas)
{$MODE DELPHI}  // (1) _NOT_ using delphi mode works
unit a;

{==============================================================================}
interface

type
  pSExp = pointer;
  aSExpArr = array[0..((MaxInt div SizeOf(pSExp)) - 1)] of pSExp;
  // aSExpArr = array[0..((MaxInt div 2*SizeOf(pSExp)) - 1)] of pSExp;
  // (2) using a _shorter_ array, eg. ^^ works on Ubuntu (Mac still Error)

  pFoo = ^aFoo;
  aFoo = record
    rec: aSExpArr;
  end;

function ahoppla(_x: pFoo): aSExpArr;

{==============================================================================}
implementation

type
  pData = ^aData;
  aData = record
    offset: array[1..24] of byte;  // (3) uncommenting offset works
    SExpArr: aSExpArr;
  end;

function ahoppla(_x: pFoo): aSExpArr;
  begin
    ahoppla:= pData(_x)^.SExpArr;
    // ahoppla:= _x.rec;           // (4) _not_ casting works on Ubuntu
(Mac error)
  end;

end {a}.
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170315/e32695ca/attachment.html>


More information about the fpc-devel mailing list