On Tue, May 11, 2004 at 06:39:57PM +0200, Frank Heckenbach wrote:
Waldek Hebisch wrote:
Frank Heckenbach wrote:
Waldek Hebisch wrote:
It looks that you are passing large arrays by value. Such arrays may cause problems at runtime due to limit on stack usage (by default 10Mb on Linux) -- arguments are passed by value and consume stack space. Unfortunatly, such array consume even more space in the compiler.
But only if they are initialized field by field or something like that, shouldn't they?
Am I missing something? AFAICS, Marten didn't show any actual code. The following program compiles fine for me (but crashes with stack overflow when trying to run it).
program Foo;
type a = array [1 .. 100000000] of Integer;
var v: a;
procedure p (v: a); begin end;
begin p (v) end.
Compiles fine with 3.2.3. Crashes with 3.3.3 and 3.4.0.
Not here:
frank@goedel:~/work# gpc3 --version gpc3 20040423, based on gcc-3.3.3 Copyright (C) 1987-2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
frank@goedel:~/work# gpc3 -O3 -g x.pas frank@goedel:~/work# ./a.out Segmentation fault frank@goedel:~/work#
The result apparently depends on the optimization level. I get this:
[~/pas]% gpc --version gpc 20030830, based on gcc-3.3.2 Copyright (C) 1987-2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[~/pas]% ulimit -s 10240 [~/pas]% gpc -g bigar.pas gpc: Internal error: Segmentation fault (program gpc1) Please submit a full bug report. See URL:http://www.gnu-pascal.de/todo.html for instructions. [~/pas]% gpc -g -O2 bigar.pas [~/pas]% ./a.out [~/pas]% gpc -g -O3 bigar.pas [~/pas]% ./a.out zsh: segmentation fault ./a.out [~/pas]%
Emil