Re: GPC compiler crash

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

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

Well, I am running Mac OS X 10.7 and it does crash the compiler on my
machine.  The error message is:

% gpc trim10-fail.p 
gpc: Internal error: Illegal instruction: 4 (program gpc1)
Please submit a full bug report.
See <URL:http://www.gnu-pascal.de/todo.html> for instructions.

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

Oh!!!  Right.  I suppose that the original author (who was a rather
smart high school student at the time) probably didn't appreciate the
distinction.  But I should have noticed it ...

Great suggestion!!

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

That compiles!

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

That works in the test program and the original (when I make all calls
var.  THANKS!  The reason is that if I define it in a procedure it
goes on the stack but if I define it globally the memory for it is
allocated as part of the program?  Why would that make a difference?

I get segmentation faults when I run with the numbers too big
(trimax=2003001).  I'm somewhat puzzled by this since I have 26G free
Physical memory ...  I calculate that for that size it should only
take 32048096 = 32,048,096 = 32M integers.  What's happening?

By the way, I've get this when I compile:

ld: warning: -macosx_version_min not specified, assuming 10.7
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in __start from /Developer/SDKs/MacOSX10.5.sdk//usr/lib/crt1.o. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie

Does that matter?  I am on 10.7 ...

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.