Pascal X86VMS-PASCAL-X0603-141

OpenVMS x86 native compilers, cross compilers news and questions.
Post Reply

Topic author
rodprince
Contributor
Posts: 18
Joined: Mon Aug 14, 2023 6:00 pm
Reputation: 0
Status: Offline

Pascal X86VMS-PASCAL-X0603-141

Post by rodprince » Mon Nov 20, 2023 4:12 pm

Installed the latest version of the pascal compiler (x86vms-pascal-x0603-141) to give it a test drive.

Tried to build our system and things got off to a real rocky start.

Code: Select all

STARTING.....> MENU () at 20-NOV-2023 14:57:12.83
VSI Pascal Fatal Error has occurred
VSI Pascal Fatal Error has occurred
%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=0000000000000020, PC=00000000013E691C, PS=0000001B
<CR><LF>  Improperly handled condition, image exit forced.
    Signal arguments:   Number = 0000000000000005
                        Name   = 000000000000000C
                                 0000000000000004
                                 0000000000000020
                                 00000000013E691C
                                 000000000000001B
    Register dump:
    RAX = 0000000000000000  RDI = 0000000003AD2A98  RSI = 0000000000000010
    RDX = 0000000000000000  RCX = 0000000000000008  R8  = 0000000000000010
    R9  = 0000000000000000  RBX = 0000000003AD2A90  RBP = 000000007ACDA4D0
    R10 = 0000000003A6B7C0  R11 = 0000000000000001  R12 = 0000000003A96B50
    R13 = 0000000000000034  R14 = 0000000003A96BA8  R15 = 0000000000000000
    RIP = 00000000013E691C  RSP = 000000007ACDA4A0  SS  = 000000000000001B
PAS error occurred in MENUTEST
STATUS = %X1000000C
%LIBRAR-I-EMPTYFILE, TOTE_DEV:[SOURCE.MENU]MENUTEST.OBJ;1 file is empty
Your build in [SOURCE.MENU] had errors
This error popup up several times during the system build. Obviously we have some bit of pascal code the new version is not thrilled with. I will attempt to identify what causes the issue as soon as I can. I fell back to the previous .139 version and everything appears to build just fine. Soon as I can finsh testing out the new VSI VMS hotfix for our install problem, I will attempt to track down what is causing the pascal issue.

Rod


jreagan
VSI Expert
Master
Posts: 139
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: Pascal X86VMS-PASCAL-X0603-141

Post by jreagan » Mon Nov 20, 2023 8:48 pm

Ugh, That's ugly. Worst case, use /DUMP=(CVT*,TERMINAL) and expect LOTS of terminal output to catch (use SPAWN/OUT or something).


Topic author
rodprince
Contributor
Posts: 18
Joined: Mon Aug 14, 2023 6:00 pm
Reputation: 0
Status: Offline

Re: Pascal X86VMS-PASCAL-X0603-141

Post by rodprince » Tue Nov 21, 2023 8:40 am

The new C compiler (VSI X86VMS C X7.4-843) left me a little something extra as well when we went to link our shared image. I fell back to the the previous version (VSI X86VMS C X7.4-785), until I have a chance to investigate it.

Code: Select all

STARTING.....> TOTESOL () at 20-NOV-2023 15:01:50.98
%ILINK-W-NUDFSYMS, 2 undefined symbols:
%ILINK-I-UDFSYM,        in6addr_any
%ILINK-I-UDFSYM,        in6addr_loopback
%ILINK-W-DRELOSYM, debug relocation for undefined symbol
        relocation type: 64
        to section: .debug_info
        offset: %X000000000000089B
        undefined symbol: in6addr_any
        module: IPSOCKETS
        file: TOTE_DEV:[SHARED]TOTELIB.OLB;1
%ILINK-W-DRELOSYM, debug relocation for undefined symbol
        relocation type: 64
        to section: .debug_info
        offset: %X0000000000000969
        undefined symbol: in6addr_loopback
        module: IPSOCKETS
        file: TOTE_DEV:[SHARED]TOTELIB.OLB;1
LNK error occurred in TOTESOL
STATUS = %X1789A0C0
Your build in [SOURCE.TOTESOL] had errors

User avatar

martinv
Master
Posts: 104
Joined: Fri Jun 14, 2019 11:05 pm
Reputation: 0
Location: Goslar, Germany
Status: Offline
Contact:

Re: Pascal X86VMS-PASCAL-X0603-141

Post by martinv » Wed Nov 22, 2023 2:30 am

This is a known problem - see this thread.. Current workaround is to link /NOOPT.
There is something wrong with everything that is popular.
(Charles Fort)


Topic author
rodprince
Contributor
Posts: 18
Joined: Mon Aug 14, 2023 6:00 pm
Reputation: 0
Status: Offline

Re: Pascal X86VMS-PASCAL-X0603-141

Post by rodprince » Wed Nov 22, 2023 9:43 am

The other little issue that came up was the following error message:

LLVM ERROR: Cannot encode high byte register in REX-prefixed instruction

Ripped down a module that was throwing the error and it reduced to the following

Please keep in mind, this is a judgement free zone, no comments about what the code is doing, I know its not
supported in any shape or form, but its what this system has used since 1985, (vax 11/730). Its just a reproducer.

Code: Select all


[PSECT (CODE_MENU),
 INHERIT('SYS$LIBRARY:STARLET')]
Module menu( input, output );

type
  $ubyte        = [byte] 0..255 ;
  $word         = [word] -32768..32767 ;
  $uword        = [word] 0..65535 ;
  $quad         = [quad,unsafe] record l0: unsigned ; l1: integer;end;

  uv_iosb_def   = [byte(8), volatile] record
                    io_status : [pos(0*8)] $uword;
                    io_length : [pos(2*8)] $uword;

                    case integer of
                      0 : ( io_term        : [pos(4*8)] $uword;
                            io_term_len    : [pos(6*8)] $uword );

                      1 : ( reserved       : [pos(4*8)] integer );

                      2 : ( buffer_address : [pos(4*8)] unsigned );
                      end;

%if ((%arch_name = "VAX") or
     (%arch_name = "Alpha") or
     (%arch_name = "IA64") or
     (%arch_name = "x86_64"))
%then

(*
(* rlp 14-Nov-2023
(*
(* I really can't say where these definitions came from. But I picked them
(* up from somewhere back when we ported from VAX to Alpha.  Some of them
(* came from the termio.mar code. I have to assume some of the rest was
(* gleamed from a source code listing or something that we had back
(* then.  Maybe the Pascal Compiler listing spit out extra data on the
(* VAX code, who knows.
(*
(* They worked for the VAX, Alpha and I64, lets hope they work for x86
(*
(* Maybe John Reagan will feel bad for us and toss in a flush routine
(* into the Pascal Extended library routines that will flush out the
(* pascal buffer.
(*
(* Maybe something like changing put(<filename>) to flush out the buffer
(* instead of doing nothing.  Oh, I have tried it and everything else, I can
(* think of to avoid this code.
(**)

type
  $BOOL = [BIT(1),UNSAFE] BOOLEAN;

  PFV$FIELDS = record case integer of
    1 : (pfv$a_buffer  : [pos( 0)] UNSIGNED;
         pfv$b_version : [pos(32)] $UBYTE;
         pfv$b_spare   : [pos(40)] $UBYTE;
         pfv$w_flags   : [pos(48)] $UWORD;
         pfv$a_pfd     : [pos(64)] UNSIGNED;
         pfv$a_fcb     : [pos(96)] UNSIGNED );

    2 : ( PFV$V_VALID       : [pos(48)] $BOOL;
          PFV$V_DFB         : [pos(49)] $BOOL;
          PFV$V_EOF_DEFINED : [pos(50)] $BOOL;
          PFV$V_EOLN        : [pos(51)] $BOOL;
          PFV$V_BOUND       : [pos(52)] $BOOL;
          PFV$V_RELBUF      : [pos(53)] $BOOL;
          PFV$V_RELPFD      : [pos(54)] $BOOL;
          PFV$V_OPEN        : [pos(55)] $BOOL;
          PFV$V_FCB_VALID   : [pos(56)] $BOOL;
          PFV$V_LOCK        : [pos(57)] $BOOL );

    3 : ( pfv$L_STATUS      : [pos(96)] unsigned );
    end;

type
  FCB$FCB_STRUCT_FIELDSET = record case integer of
    1 : (
          FCB$A_RECORD_BEG       : unsigned;  (* -24 *)
          FCB$A_RECORD_CUR       : unsigned;  (* -20 *)
          FCB$A_RECORD_END       : unsigned;  (* -16 *) );
    end;

const
  FCB$S_FCB_STRUCT = 56;
%endif

var
  io_channel      : [volatile] $uword;

(*
(* Routine used to initialize io_channel, needs to be called if you
(* really going to run this code.
(**)

[global]
procedure mu_tinit;

var
  vms_status : integer;

begin
  vms_status := $assign( 'SYS$INPUT', io_channel );

  (*
  (* whole bunch of code to determine the type of terminal and how to
  (* init it which does not apply to the
  (*
  (*  LLVM ERROR: Cannot encode high byte register in REX-prefixed instruction
  (**)

  if not odd(vms_status) then
    writeln( '\MU_TINIT Failed\ ', vms_status:1);
end;

[global]
procedure mu_prmptrd_ast ( var pfv        : text;
                           var outbuffer  : varying [n] of char ;
                           var ast_iosb   : [truncate] uv_iosb_def;
                               [unbound, asynchronous] procedure ast_completion;
                               timeout    : integer := 0 ;
                               clear_type : boolean := false;
                               no_echo    : boolean := false
                          );
(*
(*  Perform a non blocking read with prompt from the terminal.
(*  The supplied ast_completion routine will be evoked when the
(*  $qio completes.
(**)

var
  pfv_ptr      : ^PFV$FIELDS;
  fcb_ptr      : ^FCB$FCB_STRUCT_FIELDSET;
  len          : integer;
  vms_status   : integer;
  io_function  : integer;
  io_terms     : $quad;
  iosb         : uv_iosb_def;

begin
  outbuffer.length := 0;

  pfv_ptr :: integer := iaddress( pfv );
  fcb_ptr :: integer := pfv_ptr^.pfv$a_fcb - fcb$s_fcb_struct;

  len := fcb_ptr^.fcb$a_record_cur - fcb_ptr^.fcb$a_record_beg;

  fcb_ptr^.fcb$a_record_cur := fcb_ptr^.fcb$a_record_beg;

  io_function := IO$_READPROMPT;

  if timeout > 0 then
    io_function := io_function + IO$M_TIMED;

  if clear_type then
    io_function := io_function + IO$M_PURGE;


  if no_echo then
    io_function := io_function + IO$M_NOECHO;

  io_terms.l0 :=  0;
  io_terms.l1 := -1;  (* all of the bits set, char 0 to 31 *)

  vms_status := $qio( chan   := io_channel,
                      func   := io_function,
                      iosb   := ast_iosb,
                      astadr := ast_completion,
                      p1     := outbuffer.body,
                      p2     := N,
                      p3     := timeout,
                      p4     := iaddress(io_terms),
                      p5     := fcb_ptr^.fcb$a_record_beg,
                      p6     := len   );

  if not odd(vms_status) then
    writeln( '\MU_PRMPTRD_AST Failed\ ', vms_status:1);
end;

end.
{/code]
Last edited by rodprince on Wed Nov 22, 2023 11:36 am, edited 3 times in total.


johnharney
Newbie
Posts: 3
Joined: Thu Aug 24, 2023 2:45 pm
Reputation: 0
Status: Offline

Re: Pascal X86VMS-PASCAL-X0603-141

Post by johnharney » Wed Nov 22, 2023 11:46 am

The ACCVIO is caused by including /DEBUG on the compile

$pas test will not trigger the access violation

$pas/debug test will cause it.

Once the /debug option is selected, the access violation is due to the %include univtypes.red. univtypes.red would normally have several external declarations, but for this reproducer we only need one declaration.

Rod has stripped the code down to 3 files.

1) univtypes.typ
2) univtypes.red
3) test.pas

univtypes.typ

Code: Select all

const
  state_code_min   =  1;
  state_code_max   = 50    (* US states *)
                      +  8  (* US territories *)
                      + 14  (* Canada + CANADIAN provinces *)
                      + 64; (* other countries *)

  state_code_type_len =    2 ;

type
  state_code_type  = packed array[1..state_code_type_len] of char;
univtypes.red

Code: Select all

var
  state_codes : [external]
                 array [ state_code_min..state_code_max ] of state_code_type;
test.pas

Code: Select all

Program test( input, output );

%include 'univtypes.typ'
%include 'univtypes.red'

procedure scc( var signed_off   : boolean;
               var eof_on_input : boolean );
begin
  signed_off   := true;
  eof_on_input := true;
end;

var
  signed_off   : boolean := false;
  eof_on_input : boolean := false;

begin
  repeat
    scc( signed_off, eof_on_input );
  until (signed_off) or (eof_on_input);
end.
Ta!
Last edited by johnharney on Wed Nov 22, 2023 11:47 am, edited 1 time in total.


vadim
VSI Expert
Newbie
Posts: 3
Joined: Thu Nov 16, 2023 10:15 am
Reputation: 0
Status: Offline

Re: Pascal X86VMS-PASCAL-X0603-141

Post by vadim » Wed Nov 22, 2023 3:20 pm

rodprince wrote:
Wed Nov 22, 2023 11:35 am
LLVM ERROR: Cannot encode high byte register in REX-prefixed instruction
This is some inner LLVM optimizer problem. Compile with /NOOPT for now

Post Reply