Re: GPC compiler crash

Adriaan van Os <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
Thomas Schneider wrote:

> I discovered a program that crashes the GPC compiler, attached.

It doesn't crash the compiler on Mac OS X, but it does cause a runtime error, because you are 
overflowing the stack.

> procedure writeprism(var dianalysis: text; dataprism: trisquare);

Ough. You are passing a very large datastructure as value parameter, which implies that a copy of 
it is put on the stack. This costs a huge amount of stack and a lot of time. Instead, try

procedure writeprism(var dianalysis: text; var dataprism: trisquare);

> procedure themain(var da: text);
> var
>   dataprism: trisquare;   (* the data structure for diana *)

It is a local variable of main, therefore it lives on the stack. Instead, try

var
   dataprism: trisquare;   (* the data structure for diana *)

procedure themain(var da: text);

(a rare case where the use global variables is advised).

Regards,

Adriaan van Os


_______________________________________________
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.