[fpc-devel] open array and address of "@" / crash, why?

Martin Frb lazarus at mfriebe.de
Mon Mar 31 14:53:16 CEST 2014


On 31/03/2014 07:28, Michael Van Canneyt wrote:
>
>
> On Sun, 30 Mar 2014, Martin Frb wrote:
>
>>
>> Slight change, and  I get
>> Fatal: Compilation aborted
>>
>>
>>
>> procedure Foo(var c: array of integer; var c1: PA);
>> begin
>>
>>  writeln( (@c)^[1] );
>>
>>
>
> If you are counting on the implicit pointer=array as in C, then this 
> should probably be a1:=@A[0] or a1:=PA(a)

No I didn't.

c is an open array.
@c is a pointer to an open array (if something like that exists)
(@c)^ is the open array again.
(@c)^[1] is an element in that array

But this is not about the question if this works. It would be fine if it 
gave a proper error. But an "Internal Error"? That seems to be a bug.

I will shorten the example, and report it.

Leaves the question, what should it do?
1) Error: cant take the address of an open array?
2) Address of an open array is address of first member, then "(@c)^" is 
an integer, and can not have an index: Error unexpected "["....
3) Work as described in the steps above?
4) ?



More information about the fpc-devel mailing list