Re: GPC compiler crash

Thomas Schneider <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
Chief:

> procedure themain(var da: text);
> var
>   dataprism: ^trisquare;  
> begin
>    new (dataprism);
>    writeln(output,' trimdiana -gpc bug',version:4:2);
>    writeprism(da, dataprism^);
>    dispose (dataprism);
> end;
> 
> The dataprism pointer is 4 bytes on a 32-bit system. I don't know its 
> size on a 64-bit system (i.e., whether it is 4 or 8 bytes - probably 
> the latter); "sizeof (pointer)" should give you that information.
> 
> Pointers (or, at least, what they point to) are allocated on the heap, 
> so you will not overflow the stack like you did when you declared 
> dataprism as a local trisquare variable. Using a pointer, you are only 
> playing with 4 or 8 bytes on the stack, whereas, before, you were 
> playing with 490mb (which would overflow any stack).

Thanks for explaining.

Tom

  Thomas D. Schneider, Ph.D.
  Senior Investigator
  National Institutes of Health
  National Cancer Institute
  Frederick National Laboratory for Cancer Research
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  [email protected]
  http://alum.mit.edu/www/toms

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.