[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference clt::dec_pascal_bugs

Title:DEC Pascal Bug Reports
Notice:New kit announcement in TURRIS::Pascal conference
Moderator:TLE::GARRISON
Created:Wed Sep 09 1992
Last Modified:Fri May 30 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:838
Total number of notes:3659

831.0. "PASCAL-E-VARCOMFRML - PASCAL-E-NCATOA" by COPCLU::JORN (New European Champions...) Thu Mar 13 1997 12:34

Hi there,


The following testprogram has an error similar to the one mentioned in note
#23 in this conference, however this is compiled on OpenVMS AXP running V6.2.

This compiles fine on VAX running V6.1 and Pascal V5.1, but not on AXP running
Pascal V5.5. The compiler error is:


    STR$RIGHT(STR_ARRAY[I],STRENG,START);
.........................^
%PASCAL-E-VARCOMFRML, Variable is not compatible with formal parameter DESTINATI
ON_STRING
-PASCAL-E-NCATOA,       - cannot reformat content of actual's CLASS_NCA descript
or as CLASS_A
at line number 45 in file DKA200:[JORN]DMU.PAS;1

      STR$LEFT(STR_ARRAY[I],STR_ARRAY[I],SLUT);
..........................^
%PASCAL-E-VARCOMFRML, Variable is not compatible with formal parameter DESTINATI
ON_STRING
-PASCAL-E-NCATOA,       - cannot reformat content of actual's CLASS_NCA descript
or as CLASS_A
at line number 58 in file DKA200:[JORN]DMU.PAS;1

      STR$LEFT(STR_ARRAY[I],STR_ARRAY[I],SLUT);
..........................^
%PASCAL-E-VARCOMFRML, Variable is not compatible with formal parameter DESTINATI
ON_STRING
-PASCAL-E-NCATOA,       - cannot reformat content of actual's CLASS_NCA descript
or as CLASS_A
at line number 64 in file DKA200:[JORN]DMU.PAS;1
%PASCAL-E-ENDDIAGS, PASCAL completed with 6 diagnostics


Any ideas for a workaround or fix for this ??

Cheers,
Jorn.

--------------------------------------------------------------------
Testprogram follows:


[inherit ('SYS$LIBRARY:PASCAL$STR_ROUTINES')]module strenge;

  VAR LAENGDE : INTEGER;
      I       : INTEGER;
      LANG,
      START   : INTEGER;
      SLUT    : INTEGER;

PROCEDURE LAENGDEN(INDTEKST:PACKED ARRAY[I..U:INTEGER] OF CHAR;
                   VAR LANG,ST:INTEGER);EXTERNAL;


[GLOBAL] PROCEDURE ADDERE_STRENGE(
  STR_ARRAY:ARRAY[M..S:INTEGER] OF PACKED ARRAY[M1..S2:INTEGER] OF 
CHAR;
  VAR NYSTRENG:PACKED ARRAY[M3..S3:INTEGER] OF CHAR);

BEGIN
  LAENGDE:=1;
  NYSTRENG:=' ';
  FOR I := 1 TO S DO
  BEGIN
    LAENGDEN(STR_ARRAY[I],LANG,START);
    STR$REPLACE(NYSTRENG,NYSTRENG,LAENGDE,(LAENGDE+LANG),
               (SUBSTR(STR_ARRAY[I],START,LANG)));
    LAENGDE:=LAENGDE+LANG+1;
  END;
END;


[GLOBAL] PROCEDURE DELE_STRENG(
  VAR STR_ARRAY:ARRAY[M..S:INTEGER] OF PACKED ARRAY[M1..S2:INTEGER] OF 
CHAR;
  STRENG:PACKED ARRAY[M3..S3:INTEGER] OF CHAR);

VAR
  I,J  : INTEGER;
  ST   : INTEGER;
BEGIN
  LAENGDEN(STRENG,LANG,START);
  STRENG:=SUBSTR(STRENG,START,LANG);
  START:=1;
  FOR I := 1 TO S DO
  BEGIN
    STR$RIGHT(STR_ARRAY[I],STRENG,START);
    LAENGDEN(STR_ARRAY[I],LANG,ST);
    STR_ARRAY[I]:=SUBSTR(STR_ARRAY[I],ST,LANG);
    IF ST > 1 THEN START:=START+(ST-1);
    J:=LANG;
    IF LANG = S2 THEN
    BEGIN
      SLUT:=0;
      REPEAT
        IF STR_ARRAY[1,J]=' ' THEN
          SLUT:=J;
        J:=J-1;
      UNTIL SLUT > 0;
      STR$LEFT(STR_ARRAY[I],STR_ARRAY[I],SLUT);
      START:=START+SLUT;
    END
    ELSE
    BEGIN
      SLUT:=J;
      STR$LEFT(STR_ARRAY[I],STR_ARRAY[I],SLUT);
      START:=START+SLUT;
    END;

  END;
END;

END.

T.RTitleUserPersonal
Name
DateLines
831.1TLE::REAGANAll of this chaos makes perfect senseThu Mar 13 1997 17:4652
    This is due to the face that on the VAX, we use CLASS_A descriptors
    for the ARRAY [M..S:INTEGER] OF PACKED ARRAY [M1..S2:INTEGER] OF CHAR
    parameter.  On the VAX, with only byte-padding, there are no padding
    holes between each slice of the 1st dimension.  On Alpha, with
    natural alignment, there could be padding holes (not in this case
    since the ultimate array component is CHAR, but imagine if it was
    INTEGER).  
    
    The compiler's ability to map between CLASS_NCA descriptors and
    the CLASS_S descriptors for STR$RIGHT, et al. is insufficient.
    The compiler should be able to deal with such a concept in this
    case since you can describe the slice'd CLASS_NCA array with a
    CLASS_S attribute.
    
    As a workaround, you can put explicit %STDESCR foreign mechanism
    speficiers in the code.  I did:
    
(hiyall)$ diff note831.pas
************
File HIYALL$:[REAGAN]NOTE831.PAS;3
   45       STR$RIGHT(%STDESCR STR_ARRAY[I],STRENG,START);
   46       LAENGDEN(STR_ARRAY[I],LANG,ST);
******
File HIYALL$:[REAGAN]NOTE831.PAS;2
   45       STR$RIGHT(STR_ARRAY[I],STRENG,START);
   46       LAENGDEN(STR_ARRAY[I],LANG,ST);
************
************
File HIYALL$:[REAGAN]NOTE831.PAS;3
   58         STR$LEFT(%STDESCR STR_ARRAY[I],STR_ARRAY[I],SLUT);
   59         START:=START+SLUT;
******
File HIYALL$:[REAGAN]NOTE831.PAS;2
   58         STR$LEFT(STR_ARRAY[I],STR_ARRAY[I],SLUT);
   59         START:=START+SLUT;
************
************
File HIYALL$:[REAGAN]NOTE831.PAS;3
   64         STR$LEFT(%STDESCR STR_ARRAY[I],STR_ARRAY[I],SLUT);
   65         START:=START+SLUT;
******
File HIYALL$:[REAGAN]NOTE831.PAS;2
   64         STR$LEFT(STR_ARRAY[I],STR_ARRAY[I],SLUT);
   65         START:=START+SLUT;
************

    and the code then compiled just fine.  I can't think of any workaround
    that doesn't require code changes.
    
    				-John
    
    
831.2ThanxCOPCLU::JORNNew European Champions...Fri Mar 14 1997 12:567
    John,
    
    
    Thanks for having a look at it, explanation seems reasonable. I will
    forward the information to the customer.
    
    Jorn.
831.3TLE::REAGANAll of this chaos makes perfect senseThu May 29 1997 18:104
    OK, I've fixed the compiler so the program in .0 works as expected
    on OpenVMS Alpha just like it does on OpenVMS VAX.
    
    				-John