Previous | Contents | Index |
To achieve the most efficient performance, the Alpha BASIC compiler may reorder the execution of arithmetic instructions. Rarely does this result in error handling semantics that are incompatible with VAX BASIC; most programs are not affected by this change.
Use the Alpha BASIC /SYNCHRONOUS_EXCEPTIONS qualifier for those
programs that require exact VAX BASIC behavior.
C.2.10 Generation of Object Modules
In Alpha BASIC, the default behavior places all routines (SUBs,
FUNCTIONs, and main programs) compiled within a single source program
into a single module in the object file. VAX BASIC generates each
routine as a separate module. Use the Alpha BASIC
/SEPARATE_COMPILATION qualifier to duplicate VAX BASIC behavior.
See the information on qualifiers on the BASIC command line in the
Compaq BASIC for OpenVMS Alpha and VAX Systems User Manual.
C.2.11 RESUME and DEF
VAX BASIC does not enforce the documented restriction that a
RESUME statement lexically outside a DEF statement (without a target
specified) cannot resume program execution within a DEF statement.
Alpha BASIC enforces this restriction at run time.
C.2.12 Exceptions
When the Alpha BASIC compiler determines that the result of an expression is never used, the compiler does not generate code to evaluate that expression. This causes an incompatibility with VAX BASIC if the removed expression causes an exception. In the following example, the program generates a divide-by-zero error in VAX BASIC. It runs without error in Alpha BASIC because Alpha BASIC, recognizing that the variable A is never used, does not generate code to evaluate the expression that is assigned to A:
B = 5 A = B / 0 END |
There is a small difference in the way compiler messages are reported. In VAX BASIC the source information appears before the message text, and includes both source and listing line numbers. In Alpha BASIC the source information appears after the message text and includes only source line numbers.
When the Alpha BASIC compiler reports source line information, the message looks like:
%BASIC-E-xxxxxxxxx, xxxxxxxxxxxxx at line number YY in file xxxxxxxxxxx |
In both Alpha BASIC and VAX BASIC, the reported line number is
the physical source line in the file. It is not the BASIC line number
that might occur in the source program.
C.2.14 Error Status Returned to DCL
When errors occur, the Alpha BASIC and VAX BASIC compilers at
times return a different status to DCL. For example, when the file
specified at the DCL command line cannot be found, Alpha BASIC
returns BASIC--F--ABORT; VAX BASIC returns BASIC--F--OPENIN.
C.2.15 SYS$INPUT
In Alpha BASIC, when you specify SYS$INPUT as the input file
specification at the DCL command line, the object file and the listing
file are named differently from VAX BASIC. In Alpha BASIC, the
compiler names the files with the file types .OBJ and .LIS (with
nothing preceding). In VAX BASIC, the compiler names the files
NONAME.OBJ and NONAME.LIS.
C.2.16 FSS$ Function
The VAX BASIC compiler compiles a program that uses the FSS$ function, but if the FSS$ function is invoked at run time, the following run-time error is generated:
%BAS-F-NOTIMP, Not implemented |
The Alpha BASIC compiler reports all uses of the FSS$ function by generating the following error at compile time:
%BAS-E-BLTFUNNOT, built-in function not supported |
The BAS$K_FAC_NO constant is not defined on OpenVMS Alpha systems. You
should replace all occurrences of the EXTERNAL LONG CONSTANT
BAS$K_FAC_NO with EXTERNAL LONG CONSTANT BAS$_FACILITY. OpenVMS VAX
systems use the constant BAS$K_FAC_NO to communicate the facility
number between SYS$LIBRARY:BASRTL.EXE and SYS$LIBRARY:BASRTL2.EXE; it
is not needed on OpenVMS Alpha systems.
C.2.18 Math Functions with Different Results
Some math function results differ between Alpha BASIC and
VAX BASIC, because underlying OpenVMS Alpha system routines use
improved algorithms to perform these operations.
C.2.19 Floating Point Errors
Some programs that run successfully on OpenVMS VAX systems may fail on OpenVMS Alpha systems with division by zero or other floating-point errors. Examine your failing program for a dirty floating point zero. A dirty floating point zero is a number represented by a zero exponent and a nonzero mantissa. Most OpenVMS VAX system instructions treat the invalid floating-point number as a zero, but it causes an exception to be generated by some OpenVMS Alpha instructions.
You cannot create a dirty zero by using BASIC arithmetic expessions. You can create a dirty zero by reading it from a file. BASIC I/O statements, such as GET and MOVE FROM, move bytes of data to a variable without checking that the data is valid for the variable.
Correct the problem in one of the following ways:
The following is an example of a routine that cleans a single precision floating-point number (you can write similiar routines to clean double or G-floating numbers):
SUB CLEAN_SINGLE( SINGLE A ) MAP (OVER) SINGLE B MAP (OVER) WORD W1,W2 B = A IF (W1 AND 32640%) = 0% THEN A = 0 END IF END SUB |
The routine accepts a floating-point number, checks for a zero exponent, and clears the mantissa. It redefines the floating-point number as an integer so that the proper bits are tested.
For more information on floating-point formats and dirty zeros, see the
Alpha Architecture Reference Manual.
C.2.20 Error Detection on Illegal MAT Operations
Following are two differences in error detection on illegal MAT operations:
MAT B = A * B |
There are debugging differences between VAX BASIC and Alpha BASIC, especially during use of the debugger STEP command around exception handlers, DEF functions, external subprograms, and GOSUB routines.
These differences are described below and in the Compaq BASIC for OpenVMS Alpha and VAX Systems User Manual.
When the debugger STEP command is used in source code containing an error, differences occur in the Debugger behavior between OpenVMS VAX and OpenVMS Alpha. These differences are due to architectural differences in the hardware and software of the two systems.
In Alpha BASIC, a STEP at a statement that causes an exception might never return control to the debugger. The debugger cannot determine what statement in the BASIC source code will execute after the exception occurs. Therefore, set explicit breaks if you use STEP on statements that cause exceptions.
The following hints should help when you use the STEP command to debug programs that handle errors:
Following are differences in listing files between Alpha BASIC and VAX BASIC:
This section describes differences between Alpha BASIC,
VAX BASIC, and other languages within the common language
environment.
C.3.1 Creating PSECTs with COMMON and MAP Statements
In Alpha BASIC, the PSECT attributes are different from those in VAX BASIC, as follows:
Alpha BASIC | VAX BASIC |
---|---|
NOPIC | PIC |
NOSHR | SHR |
Alignment of OCTAWORD | Alignment of LONG |
In Alpha BASIC, the lengths of the PSECTs that the COMMON and MAP statements create are rounded up to a multiple of 16. The size of COMMON or MAP does not change; the size of the PSECT does. This change is visible only to applications that use shareable images in a multilanguage environment.
Both Alpha BASIC and VAX BASIC create PSECTs that are
compatible with those of other languages on the same platform, with the
exception of MACRO. You can link with modules written in languages
other than MACRO without changing code. If you link against MACRO
modules that reference these PSECTs, you may need to make corresponding
changes in the MACRO code.
C.3.2 64-Bit Floating-Point Data
In most other Compaq languages, the default 64-bit floating-point data type has changed from D_floating on OpenVMS VAX systems to G_floating on OpenVMS Alpha systems. If you communicate BASIC DOUBLE (OpenVMS D_floating) data between BASIC and one of the other languages that have made this change, you need to do one of the following:
Direct use of the following routines by Alpha BASIC programs is unsupported. Attempts to execute any of these routines will result in an error.
In LIB$ROUTINES module:
LIB$INSERT_TREE_64
LIB$SHOW_VM_64
LIB$SHOW_VM_ZONE_64
In STARLET module:
SYS$CREATE_BUFOBJ_64
SYS$CREATE_GFILE
SYS$CREATE_GPFILE
SYS$CREATE_REGION_64
SYS$CRETVA_64
SYS$CRMPSC_FILE_64
SYS$CRMPSC_GFILE_64
SYS$CRMPSC_GPFILE_64
SYS$DELTVA_64
EXPREG_64
SYS$IO_CLEANUP
SYS$IO_PERFORM
SYS$IO_PERFORMW
SYS$LCKPAG_64
SYS$LKWSET_64
SYS$MGBLSC_64
SYS$PURGE_WS
SYS$SETPRI_64
SYS$ULKPAG_64
SYS$ULWSET_64
SYS$UPDESC_64
SYS$UPDSEC_64W
Index | Contents |