HP Pascal/HP-UX Release Notes HP 9000 Series Systems Version A.10.08 5965-4465 May 1997 Printed in: U.S.A.
Legal Notices The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this manual, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material.
Contents 1. New and Changed Features Release 10.20 Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 Optimization Levels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Optimization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Combining Optimization Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 Obsolete Optimizer Options. . . . . . . . . . . . . . . . . . . . . . . . .
Contents Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Control Block List. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Control Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Heap Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other Libraries (Trap and Unwind Libraries) . . . . . . . . . . . . . . . . . .
Contents longreal Precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 anyptr, globalanyptr, and localanyptr . . . . . . . . . . . . . . . . . . . . . . . .46 Other Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 Features Supported only on Series 300/400. . . . . . . . . . . . . . . . . . . .47 Features Supported only on Series 700/800. . . . . . . . . . . . . . . . . . . .47 Command-Line Options . . . . . . . . . . . . .
Contents 6
Summary of Technical Changes HP-Pascal/HP-UX Release 10.30 includes no new technical features and does not include thread-specific data support. The new features available with HP Pascal/HP-UX Release 10.20 included: • New architecture options for optimization and portability • New scheduling option for PA-RISC 2.
1 New and Changed Features HP-Pascal/HP-UX Release 10.30 includes no new technical features and does not include thread-specific data support. It is not kernel thread safe. See “Making Thread-Safe HP Pascal/HP-UX Routines” on page 31" for more information. This chapter describes the new and changed features for HP Pascal/HP-UX in Release 10.0, 10.01, and 10.20.
New and Changed Features Release 10.20 Changes Release 10.20 Changes The Release 10.20 changes are described here: • New +DA designations for PA-RISC 2.0 model and processor numbers to generate code for the PA-RISC 2.0 systems. Also a +DAportable option to generate code compatible across PA-RISC 1.1 and 2.0 workstations and servers. Default architecture object code generation is now determined automatically for all systems as that of the machine on which you compile. • New +DS designations for PA-RISC 2.
New and Changed Features Optimization Levels Optimization Levels HP Pascal/HP-UX supports five levels of optimization. The corresponding command-line options are summarized in Table 1-1. NOTE HP Pascal/HP-UX does not support some of the +O3 and +O4 optimization features that are available in other compilers. Table 1-1 Optimization Levels Option Meaning +O0 Minimal optimization, including constant folding and simple register assignment. This is the default.
New and Changed Features Optimization Levels Option +O4 Meaning Full optimization across all files in the program that were compiled with +O4. Performed at link time. By postponing optimization until link time, the optimizer can make the best use of execution profiling information and can perform inlining across multiple source files.
New and Changed Features Optimization Parameters Optimization Parameters Additional general and specific/advanced parameters allow you to enable or disable certain types of optimization techniques according to their effect on code size, compilation time, run-time performance, and other user-visible effects. In addition to the general parameters that control types of optimizations, there are specific parameters that control optimizations within those types.
New and Changed Features Optimization Parameters Table 1-2 General Optimization Options General Option Optimization Performed +Oaggressive enables optimizations that can result in significant performance improvement, but can change a program's behavior.
New and Changed Features Optimization Parameters General Option +O[no]entrysched Levels 2, 3, 4 Optimization Performed The +Oentrysched option optimizes instruction scheduling on a procedure's entry and exit sequences. Enabling this option can speed up an application. The option has undefined behavior for applications which handle asynchronous interrupts. The option affects unwinding in the entry and exit regions.
New and Changed Features Optimization Parameters Table 1-3 Advanced Optimization Options Advanced Option Optimization Performed +O[no]fastaccess +Ofastaccess optimizes for fast access to global data items. Levels 0, 1, 2, 3, 4 Use +Ofastaccess to improve execution speed at the expense of longer compile and link times. At all optimization levels, except level 4, the default is +Onofastaccess. At optimization level 4, the default is +Ofastaccess.
New and Changed Features Optimization Parameters Advanced Option Optimization Performed Specifying +Ofltacc disables the generation of FMA instructions as well as some other floating-point optimizations. Use +Ofltacc if it is important that the compiler evaluate floating-point expressions as it does in unoptimized code. The +Ofltacc option does not allow any optimizations that change the order of expression evaluation and therefore may affect the result.
New and Changed Features Optimization Parameters Advanced Option Optimization Performed +Olibcalls invokes faster versions of a number of frequently called intrinsic functions. It also moves invariant function expressions out of loops. +O[no]libcalls Levels 0, 1, 2, 3, 4 The sqrt function is executed as a hardware instruction. If the code is compiled for the PA-RISC 1.0 architecture (e.g., with +DA1.
New and Changed Features Optimization Parameters Advanced Option +O[no]procelim Levels 0, 1, 2, 3, 4 Optimization Performed +Oprocelim removes routines from the executable file that are not referenced by the application. Use +Oprocelim to reduce the size of the executable file, especially when optimizing at levels 3 and 4 when inlining may have removed calls to some routines. The default is +Onoprocelim at optimization levels 0 through 3 and +Oprocelim at level 4.
New and Changed Features Optimization Parameters pc +O3 +Oconservative prog.p Note that the +Oaggressive and +Oconservative parameters are incompatible and cannot be used on the same command line.
New and Changed Features Memory Consumption When Compiling at Optimization Level 4 Memory Consumption When Compiling at Optimization Level 4 When you link a program, the compiler brings all modules that were compiled at optimization level 4 into virtual memory at the same time. Depending on the size and number of the modules, compiling at +O4 can consume a large amount of virtual memory. If you are linking a large program that was compiled with the +O4 option, you may notice a system slow down.
New and Changed Features Profile-Based Optimization (PBO) Profile-Based Optimization (PBO) Profile-based optimization (PBO) is a set of code-improving transformations that are based on feedback concerning the run-time characteristics of an application. Run-time profile data is collected during program execution.
New and Changed Features Profile-Based Optimization (PBO) procedures. Also, note that when you use the +I compile-line option to compile source files, instrumentation can be added within the code for each subroutine in that file. In the following example, the source file sample.p is compiled, instrumented, and linked into sample.inst: pc -o sample.inst -O +I sample.p Collecting Execution Profile Statistics To collect execution profile statistics, run your program using reasonably representative data.
New and Changed Features Profile-Based Optimization (PBO) Maintaining Multiple Profile Data Files By default, PBO logs the profile statistics in a file called flow.data. You can specify another name with the +df compile-line option. The name of the executable file used during profiling is the name under which the profile data is stored in the database file.
New and Changed Features +DA Command-Line Option +DA Command-Line Option +DAmodel Generates object code for a particular version of the PA-RISC architecture. Also specifies which version of the HP-UX math library to link in when you have specified -lm. (See the HP-UX Floating-Point Guide for more information about using math libraries.) NOTE Object code generated for PA-RISC 2.0 will not execute on PA-RISC 1.1 systems. To generate code compatible across PA-RISC 1.1 and 2.
New and Changed Features +DA Command-Line Option model Parameter model can be either a model number of an HP 9000 system (such as 730, 877, F20, or I50); PA-RISC architecture designations 2.0 or 1.1; or the term portable. Use the +DAportable compiler option to generate code compatible across 1.1 and 2.0 workstations and servers. See the file /opt/langtools/lib/sched.models for a list of model numbers and their PA-RISC architecture designations.
New and Changed Features +DS Command-Line Option +DS Command-Line Option +DSmodel Performs instruction scheduling tuned for a particular implementation of the PA-RISC architecture. Object code with scheduling tuned for a particular model will execute on other HP 9000 systems, although possibly less efficiently. If you do not specify this option, the default instruction scheduling is for the system you are compiling on. If you plan to run your program on both PA-RISC 1.1 and 2.0 systems, use the +DS2.
New and Changed Features +DS Command-Line Option Using +DS to Specify Instruction Scheduling Instruction scheduling is different on different implementations of PA-RISC architectures. You can improve performance on a particular model or processor of the HP 9000 by requesting that the compiler use instruction scheduling tuned to that particular model or processor. Using scheduling for one model or processor does not prevent your program from executing on another model or processor.
New and Changed Features HP Pascal/HP-UX Built-In Functions HP Pascal/HP-UX Built-In Functions Two built-in functions are available in HP Pascal/HP-UX. roundlong The roundlong function returns the longint value of the argument, rounded to the nearest integer. If x is positive or zero, roundlong(x) is equivalent to trunclong(x+0.50); otherwise, roundlong(x) is equivalent to trunclong(x-0.50). It is an error if the result is greater than 263-1 or less than -263.
New and Changed Features Debugging Optimized Code (DOC) Debugging Optimized Code (DOC) In conjunction with the HP Distributed Debugging Environment (DDE), the HP Pascal/HP-UX compiler now provides support for debugging optimized code. This support includes: • Tracebacks with line-number annotation. • Setting breakpoints and single-stepping at the source statement level. • Mapping between source statements and machine instructions. • Viewing and modifying global variables at procedure call boundaries.
New and Changed Features Making Thread-Safe HP Pascal/HP-UX Routines Making Thread-Safe HP Pascal/HP-UX Routines Kernel threads: Pascal was not thread safed with kernel threads in mind. Pascal is Thread-Restricted C. Pascal is not fork-safe. Nor cancellation safe. User threads: Thread-Safe Performance Constrained/Tuned except for the limitations in Input/Output listed below which is Thread-Restricted C. Pascal is not fork-safe. It assumes no cancellations are possible.
New and Changed Features Making Thread-Safe HP Pascal/HP-UX Routines Input/Output Because of the language definition of various Pascal I/O statements, it is impossible to make them completely thread-safe. For example, WRITELN(f,a,b,c); is replaced by WRITE(f,a); WRITE(f,b); WRITE(f,c); WRITELN(f); and READDIR(f,k,x); is replaced by SEEK(f,k); READ(f,x); In a threaded application, the input or output could be interspersed.
New and Changed Features Making Thread-Safe HP Pascal/HP-UX Routines File Control Blocks The file control blocks themselves are not protected. There is a control block for each opened file. Reading, writing, and other operations on a file search the list and update the file's control block or return information from the control block. Each control block contains its own buffer for file reading and writing. The file control blocks must reside in a shared data area.
New and Changed Features Making Thread-Safe HP Pascal/HP-UX Routines The only other construct that is important to note is that certain string manipulation operators and functions use the heap for temporary storage. This is thread-safe but may cause a performance problem. You can use the $STRINGTEMPLIMIT$ compiler option to allocate space in the stack.
New and Changed Features Referencing Shared-Library Data (+k Option) Referencing Shared-Library Data (+k Option) The HP Pascal/HP-UX compiler now can generate long-displacement code sequences for referencing global data. This behavior is triggered by the +k command-line option and conflicts with generating Position Independent Code (PIC). Compiling with +k becomes necessary in the rare case when a program references a very large number of distinct variables that are defined in shared libraries.
New and Changed Features Four-Byte Extended UNIX Code (EUC) Four-Byte Extended UNIX Code (EUC) The following information supplements Chapter 3, "Data Types", of the HP Pascal/HP-UX Reference Manual. HP Pascal/HP-UX supports four-byte Extended UNIX Code (EUC) characters in file names, comments, and string literals.
New and Changed Features System V Release 4 (SVR4) File Layout System V Release 4 (SVR4) File Layout In Release 10.0, 10.01, and 10.20, the file system layout has been changed to correspond with the System V Release 4 (SVR4) format. The new standard directory location for Pascal is /opt/pascal. For common files that span multiple products, such as debuggers and HP PAK, the new standard directory is /opt/langtools. This common directory eliminates duplicate files in different directories.
New and Changed Features Environment Variables Used by HP Pascal/HP-UX Environment Variables Used by HP Pascal/HP-UX HP Pascal/HP-UX Release 10.0 uses the following environment variables somewhat differently than it previously did: LPATH MANPATH NLSPATH PATH HP Pascal/HP-UX Release 10.01 uses a new environment variable to determine how the runtime library processes floating-point number string format: PASRUNOPTS The following sections describe how HP Pascal/HP-UX uses each variable.
New and Changed Features Environment Variables Used by HP Pascal/HP-UX PATH To invoke pc, set PATH to include /opt/pascal/bin. PASRUNOPTS PASRUNOPTS is a new Pascal runtime variable that determines how the runtime library processes floating-point number string format. This variable can be used to increase the portability of PASCAL to other languages and vendors. Description The table for this variable (see Table 1-5) is divided into three columns; currently only column 1 is supported.
New and Changed Features Environment Variables Used by HP Pascal/HP-UX Example PASRUNOPTS="E"; export PASRUNOPTS program prog(output); begin writeln(1.0L+200) end. The output from this example is 1.0E+200. The variable is only fetched from the environment once, the first time that it is needed. Changing the environment will not have an effect on the runtime library.
New and Changed Features Distributed Debugging Environment (DDE) Distributed Debugging Environment (DDE) For information on the Distributed Debugging Environment (DDE), refer to HP-UX Programming Tools Release Notes.
New and Changed Features New Warning Messages New Warning Messages The following warning messages for the +Oinitcheck optimization parameter have been added to HP Pascal/HP-UX. 585 MESSAGE CONDITIONAL USE OF UNINITIALIZED VARIABLE '!' (585) W CAUSE The local variable mentioned in the message may be uninitialized when used in this procedure or function. It may be initialized in a THEN clause and not the ELSE clause. Or it may not appear in all statements of a CASE.
New and Changed Features Porting HP Pascal/HP-UX Programs Porting HP Pascal/HP-UX Programs If you plan to run your programs only on HP computers, the effort to port your programs between HP computers is minimal and the extra features that HP Pascal/HP-UX provides will make your programming much easier. However, if you plan to port your programs to another vendor's computer, the effort to do so will be proportional to your use of nonstandard HP Pascal/HP-UX extensions.
New and Changed Features Porting HP Pascal/HP-UX Programs Table 1-6 HP Pascal/HP-UX Data Types Size (bytes) Type Alignment (300/400) Alignment (700/800) bit16 2 Not supported 2 bit32 4 Not supported 4 bit52 8 Not supported 4 boolean 1 1-byte 1-byte char 1 1-byte 1-byte enumeration 2a 2-byte 1-, 2-, or 4-byte, based on declared range subrange of enumeration 2a same as host enumeration type 2-byte or 4-byte, based on declared range $extnaddr$ pointer 8 Not supported 4 inte
New and Changed Features Porting HP Pascal/HP-UX Programs Control Constructs • The TRY/RECOVER construct is supported on all HP-UX implementations. Escape codes for errors differ significantly between the implementations. • The mark and release procedures are supported on all HP-UX implementations. There are minor differences in behavior but code is essentially portable.
New and Changed Features Porting HP Pascal/HP-UX Programs Assignment to Procedure Variables Assignment to a procedure variable has a different syntax on each of the two architectures. Maximum String Size On the Series 300/400, the maximum string size is 255 characters. By specifying the LONGSTRINGS compiler option, maximum string size is virtually unlimited. The string size on Series 700/800 is unlimited. ANYVAR Parameters ANYVAR is supported on all HP-UX implementations.
New and Changed Features Porting HP Pascal/HP-UX Programs Other Features • Program parameters have slight semantic differences between Series 300/400 and Series 700/800. • Arguments for the + operator with strings differ between Series 300/400 and Series 700/800. For example, chr cannot be used with + on Series 700/800. • Series 300/400 and Series 700/800 each generate different listings. Features Supported only on Series 300/400 • You can use the addr function to get the address of a constant.
New and Changed Features Porting HP Pascal/HP-UX Programs • packed array of char requires a lower bound of one. Command-Line Options Table 1-7 summarizes the command-line options that are available only on the Series 300/400 or that behave differently on the Series 700/800. Table 1-7 Command-Line Options Specific to Series 300/400 Command Option Effect +A Use 2-byte alignment rules. +bfpa Affect floating-point operations. +ffpa Affect floating-point operations.
New and Changed Features Porting HP Pascal/HP-UX Programs Command Option Effect -L Produce a program listing to stdout. +N Turn off generation of notes. +O0, +O1, +O2, +O3, +O4 Set optimization level. +O[no]aggressive, +O[no]all, +O[no]conservative, +O[no]dataprefetch, +O[no]limit, +O[no]size, +O[no]entrysched, +O[no]fastaccess, +O[no]fltacc, +O[no]initcheck, +O[no]libcalls, +O[no]loopunroll, +O[no]moveflops, +O[no]pipeline, +O[no]procelim, +O[no]regionsched, +O[no]regreassoc Modify optimization.
New and Changed Features Porting HP Pascal/HP-UX Programs Compiler Options The HP Pascal/HP-UX compilers support a wide range of compiler options. Some options are identical on all systems. Some options are unique to a particular system. Some options have different semantics and slightly different syntax from one system to the other. For portable code, keep compiler options to a minimum and avoid options that affect the semantics of the language or enable system level programming extensions.
New and Changed Features Porting HP Pascal/HP-UX Programs Compiler Option Effect LONGSTRINGS Extends the maximum length of strings from 255 characters to virtually any length. RANGEa Does run-time checks for range errors. SAVE_CONST Controls scope of structured constants. SEARCHa Specifies files to be used to satisfy IMPORT declarations. This option must be the last option on an option list. SEARCH_SIZE Changes number of external files that can be searched. The default is 9.
New and Changed Features Porting HP Pascal/HP-UX Programs Compiler Option Effect ASSUME Sets optimizer assumptions. BUILDINT Causes the compiler to build an intrinsic file rather than an object code file. CHECK_ACTUAL_PARM Sets level of type checking of actual parameters for separately compiled functions or procedures. CHECK_FORMAL_PARM Sets level of type checking of formal parameters for separately compiled functions or procedures. CODEa Generates object code after parsing a compilation block.
New and Changed Features Porting HP Pascal/HP-UX Programs Compiler Option Effect HP_DESTINATION HP_DESTINATION 'ARCHITECTURE generates object code for a particular version of of the PA-RISC architecture. HP_DESTINATION 'SCHEDULER performs instruction scheduling tuned for a particular implementation of the PA-RISC architecture. IF/ELSE/ENDIF a Controls conditional compilation. Refer to the HP Pascal/HP-UX Reference Manual; for the Series 700/800 for details.
New and Changed Features Porting HP Pascal/HP-UX Programs Compiler Option Effect S300_EXTNAMES Changes external names to a form consistent with Series 300/400 conventions. SEARCHa Specifies one or more files for the compiler to search for module definitions. SHLIB_CODE Generates PIC object code that you can use to create libraries. SKIP_TEXT Causes the compiler to ignore source code. STANDARD_LEVELa Defines the compatibility level with various versions of Pascal.
2 Installation Information Read this entire document, and any other Release Notes or READMEs you may have before you begin an installation. After loading the HP-UX 10.30 or later operating system, you can install HP Pascal/HP-UX. To install your software, run the SD-UX swinstall command. It will invoke a user interface that will lead you through the installation.
Installation Information 56 Chapter 2
3 Relevant Documentation 57
Relevant Documentation HP Pascal/HP-UX Language Manuals HP Pascal/HP-UX Language Manuals • HP Pascal/HP-UX Reference Manual (92431-90005) • HP Pascal/HP-UX Programmer's Guide (92431-90006).
Relevant Documentation Other Manuals Other Manuals • HP-UX Floating-Point Guide • HP-UX System Administration Tasks • Programming With Threads on HP-UX • Procedure Calling Conventions Reference Manual • PA-RISC 2.
Relevant Documentation Additional Documentation Additional Documentation • ALLBASE/SQL Pascal Application Programming Guide (36217-90007) • HP C Programmer's Guide (92434-90002) • HP-DDE Debugger Online Help Refer to the discussion on basic-style (not advanced-style) debugging of optimized code in the HP/DDE debugger online help.
Relevant Documentation Additional Documentation The +help option may not work on systems running HP CDE. If it does not work, ensure the environment variable DTHELPSEARCHPATH is set. (It may not be set if you rlogin to a system, for example.) If it is not set, use the following command to set it: eval $(dtsearchpath) Ensure the LANG environment variable is set, typically LANG=C.
Relevant Documentation Additional Documentation 62 Chapter 3
Problem Descriptions and Fixes 4 Problem Descriptions and Fixes Chapter 4 63
Problem Descriptions and Fixes Problems Encountered with Combining Options +DA2.0 and +O2 Problems Encountered with Combining Options +DA2.0 and +O2 The following problems relate to the use of +DA2.0 with the optimization option +O2. (This problem does not affect the use of +DS2.0.) It is recommended that you use +DA1.1 if any of the following errors occur. They are all related to specific optimizations made for PA-RISC 2.0 systems dealing with 64-bit register support.
Problem Descriptions and Fixes Operating System and Compiler Information Operating System and Compiler Information For information on HP Pascal/HP-UX product problems and fixes, refer to the Software Status Bulletin or the Software Release Bulletin. The product number to assist you in finding SSB and SRB reports for HP Pascal/HP-UX on the Series 700 and 800 is 92431A.