[comp.unix.questions] Problem with BSD Pascal on a Gould

KFL@AI.AI.MIT.EDU (Keith F. Lynch) (04/13/87)

I recently started using the BSD pascal compiler on a Gould.  It
compiled several short programs with no problem.  When I attempted
to compile a 4000 line program (with the line "pc -w foo.p" and with
the line "pc foo.p" if it matters) after two minutes I got about 100
lines like the following:

"/tmp/p0005401", line 12522: emit_rmem: offset too large or negative - 0x10810
"/tmp/p0005401", line 12535: emit_rmem: offset too large or negative - 0x10810
"/tmp/p0005401", line 12536: emit_rmem: offset too large or negative - 0x107e0
"/tmp/p0005401", line 12546: emit_rmem: offset too large or negative - 0x10810

No executable ("a.out") is produced.

My program made no reference to any file in /tmp, has no line in the
twelve thousands, and has nothing named emit_rmem.  Also, if my program
contains a fatal compile error, the compiler flags it and does NOT
produce the above errors.  Also, it finishes sooner.  So it appears that
the above error messages are a problem with the compiler or with the OS,
not with my program.  Does anyone know what this means, and how I can
fix it?

Please reply to me, I am not on this list.
								...Kei

john@polyof.UUCP (05/08/87)

In article <6849@brl-adm.ARPA>, KFL@AI.AI.MIT.EDU (Keith F. Lynch) writes:
> I recently started using the BSD pascal compiler on a Gould.  It
> compiled several short programs with no problem.  When I attempted
> to compile a 4000 line program (with the line "pc -w foo.p" and with
> ...
> "/tmp/p0005401", line 12522: emit_rmem: offset too large or negative - 0x10810
> "/tmp/p0005401", line 12535: emit_rmem: offset too large or negative - 0x10810
> "/tmp/p0005401", line 12536: emit_rmem: offset too large or negative - 0x107e0
> "/tmp/p0005401", line 12546: emit_rmem: offset too large or negative - 0x10810
> 

Well, being that I ported the BSD pascal compiler to the Gould Concept
machines, for Gould, perhaps I can shed some light on the problem.

The error you describe is from the assembler I believe.  Sounds like you
are trying to pass a big array to a subroutine/function by value. (IE
no "var").  When you do this, the compiler generates "movw	blah, b2[offs]"
instructions for EACH element of the array you are passing.  If you
pass in excess of 32K, offs get's too big to work off a single base register,
and the assembler will bitch.  The bottom line is: you can't pass
things > ~30K on the stack in pascal (any language for that matter) on
a gould, since it limits the immediate offseting of any base register to
64K. (32k in each direction).

Solution: try making the array reference call by reference, not value.
(Use 'var' in in the subroutine declaration for the parameter.)

If this is not your problem, then it is likely that the folks at Gould
munged 'pc' somewhere else.

John Buck
Polytechnic Univ.
Route 110
Farmingdale, NY 11735
polyof!john