[comp.lang.pascal] PASCAL V4.0 problem with NEW ?

deknuydt@esat.kuleuven.ac.be (06/29/90)

   Recenty I experimented with VAX-PASCAL VERSION 4.0's dynamic allocation.
   I think I've discovered some inconsistent behavior.  
   Can someone tell me what I am doing wrong ?

   Try this :
  
   PASCAL testprogram
   LINK   testprogram
   RUN    testprogram
   Enter number (E.g. 10 )
   %PAS-F-LOWGTRHIGH, low-bound exceeds high-bound
   %TRACE-F-TRACEBACK, symbolic stack dump follows
   module name     routine name                     line       rel PC    abs PC

   TESTPROGRAM     TESTPROGRAM                        21      00000055  00000275
   
   However, when you compile, link and run it with /DEBUG, all seems OK.

   The error also doesn't occur 
     1)  when 'number' is not a run-time expression,
           but a compile time-expression.  
     2)  when you issue only one 'NEW' on such a pointer type.

   B.t.w. we're running VMS V5.3-1.

   Maybe some expert has more on this ...


--------------------------CUT-HERE----------------------------------------------

PROGRAM testprogram (input,output);

TYPE
    array_of_sets (beginelement,endelement,setelements : integer) = 
       ARRAY [beginelement..endelement] OF 
         SET OF 1..setelements;
    ptr_to_array_of_sets = ^array_of_sets;
VAR
  ptr_to_array_of_set_1,
  ptr_to_array_of_set_2      : ptr_to_array_of_sets; 
  number  : integer;
BEGIN
write('Enter number (E.g. 10 ) '); readln (number);
NEW(ptr_to_array_of_set_1, 1, 5, number);
NEW(ptr_to_array_of_set_2, 1, 5, number);
END.
  
--------------------------CUT-HERE----------------------------------------------

  #exclude <stddisclaimer>

  DeKnuydt Bert                         Tel.  +32 16 220931 ext. 1087
  K.U.Leuven / ESAT / MI2               Fax   +32 16 221855
  Kardinaal Mercierlaan 94              TELEX 25941 ELEKUL
  B-3030 Heverlee                       Email deknuydt@esat.kuleuven.ac.be
  B E L G I U M