Mariusz Zynel wrote:
Hi All,
Due to some inquires I had recently, have just build latest GPC
(20011202) under Solaris 8 using GCC 2.95.3. Binaries are packaged
with native Solaris tools and are available at:
ftp://math.uwb.edu.pl/pub/solaris8
as well as:
ftp://agnes.dida.physik.uni-essen.de/home/mariusz
Is it compiled so that it doesn't execute procedural
parameters in the stack? The following discussion is
from comp.lang.pascal.misc:
------------------ * clip starts here * ----------------------
Serafim,
I don't think it's your code - I think it's the GNU compiler.
Look in /etc/system - you may find a variable like 'no_exec_stack = 1'
set
that prohibits executing code from the stack. It's an optional security
feature in Solaris.
Good Luck,
-S
On Fri, 26 Oct 2001, Serafim Dahl wrote:
The program below is implemented with the sole intention to
show how to use procedures as parameters to procedures. However, it
works
when compiled with SUN Workshop Pascal but not when compiled
with GNU Pascal. When trying to start it when compiled with
GNU Pascal (version 20010623 on a Solaris 8, Ultra 5)
I get the following error message:
Oct 26 17:05:11 serafim.nada.kth.se genunix:
NOTICE: test[4264] attempt to execute code on stack by uid 1167
Segmentation Fault
Here is the program:
PROGRAM test(input,output);
CONST low = 1;
high = 10;
TYPE index = low..high;
natural = 0..Maxint;
item = natural;
intTable = ARRAY [index] OF item;
VAR table : intTable;
PROCEDURE doToEach(VAR t: intTable; PROCEDURE toDo(VAR i: item));
PROCEDURE iter(n: index);
BEGIN
toDo(t[n]);
IF n < high THEN iter(Succ(n))
END;
BEGIN
iter(low)
END;
FUNCTION sum(VAR t: intTable): item;
VAR tmpSum: item;
PROCEDURE addItem(VAR i: item);
BEGIN
tmpSum := tmpSum + i
END;
BEGIN
tmpSum := 0;
doToEach(t, addItem);
sum := tmpSum
END;
PROCEDURE readTable(VAR t: intTable);
PROCEDURE readItem(VAR i: item);
BEGIN
Read(i)
END;
BEGIN
doToEach(t, readItem)
END;
BEGIN
Write('Enter ten numbers ');
readTable(table);
Writeln('The sum is ', sum(table):1);
END.
-------------------- * end of clip * ------------------