Domain/C Compiler Software Release Document
Compiler Versions 6.7.m, 6.7.p, 6.7.mpx, 6.7.pmx
August 21, 1989
This document describes the Domain/C (TM) Version 6.7 compilers.
It lists all changes made to the Domain/C compiler since SR10.1, all
bugs fixed during this time, and all known bugs that are still current.
Restricted Rights Notice
Use, duplication, or disclosure by the Government is subject to restrictions
as set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data
and Computer Software clause at DFARS 52.227-7013.
Apollo Computer Inc.
330 Billerica Road
Chelmsford, MA 01824
(508) 256-6600
Notice: Notwithstanding any other lease or license agreement that may
pertain to, or accompany the delivery of, this computer software, the rights
of the Government regarding its use, reproduction and disclosure are as set
forth in Section 52.227-19 of the FARS Computer Software - Restricted Rights
clause.
Copyright 1989 Apollo Computer Inc., Chelmsford, Massachusetts. Unpublished
-- all rights reserved under the Copyright Laws of the United States.
This notice shall be marked on any reproduction of these data, in whole or
in part.
Confidential and Proprietary. Copyright 1989 Apollo Computer Inc.,
Chelmsford, Massachusetts. Unpublished -- rights reserved under the
Copyright Laws of the United States. All Rights Reserved.
Latest Printing: August, 1989
This document was formatted using the FMT tool distributed with the Domain
computer system.
Apollo and Domain are registered trademarks of Apollo Computer Inc.
ETHERNET is a registered trademark of Xerox Corporation.
Personal Computer AT and AT are registered trademarks of International
Business Machines Corporation.
UNIX is a registered trademark of AT&T in the USA and other countries.
3DGMR, Aegis, D3M, DGR, Domain/Access, Domain/Ada, Domain/Bridge, Domain/C,
Domain/C++, Domain/ComController, Domain/CommonLISP, Domain/CORE,
Domain/Debug, Domain/DFL, Domain/Dialogue, Domain/DQC, Domain/IX,
Domain/Laser-26, Domain/LISP, Domain/PAK, Domain/PCC, Domain/PCI,
Domain/SNA, Domain X.25, DPSS, DPSS/Mail, DSEE, FPX, GMR, GPR, GSR, NLS,
Network Computing Kernel, Network Computing System, Network License Server,
Open Dialogue, Omniback, Open Network Toolkit, Open System Toolkit, Personal
Supercomputer, Personal Super Workstation, Series 3000,Series 3500, Series
4000, Series 4500, Series 10000, and VCD-8 are trademarks of Apollo Computer
Inc.
Apollo Computer Inc. reserves the right to make changes in specifications
and other information contained in this publication without prior notice,
and the reader should in all cases consult Apollo Computer Inc. to determine
whether any such changes have been made.
THE TERMS AND CONDITIONS GOVERNING THE SALE OF APOLLO COMPUTER INC. HARDWARE
PRODUCTS AND THE LICENSING OF APOLLO COMPUTER INC. SOFTWARE PROGRAMS CONSIST
SOLELY OF THOSE SET FORTH IN THE WRITTEN CONTRACTS BETWEEN APOLLO COMPUTER
INC. AND ITS CUSTOMERS. NO REPRESENTATION OR OTHER AFFIRMATION OF FACT
CONTAINED IN THIS PUBLICATION, INCLUDING BUT NOT LIMITED TO STATEMENTS
REGARDING CAPACITY, RESPONSE-TIME PERFORMANCE, SUITABILITY FOR USE OR
PERFORMANCE OF PRODUCTS DESCRIBED HEREIN SHALL BE DEEMED TO BE A WARRANTY BY
APOLLO COMPUTER INC. FOR ANY PURPOSE, OR GIVE RISE TO ANY LIABILITY BY APOLLO
COMPUTER INC. WHATSOEVER.
IN NO EVENT SHALL APOLLO COMPUTER INC. BE LIABLE FOR ANY INCIDENTAL,
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING BUT NOT
LIMITED TO LOST PROFITS) ARISING OUT OF OR RELATING TO THIS PUBLICATION OR
THE INFORMATION CONTAINED IN IT, EVEN IF APOLLO COMPUTER INC. HAS BEEN
ADVISED, KNEW OR SHOULD HAVE KNOWN OF THE POSSIBILITY OF SUCH DAMAGES.
THE SOFTWARE PROGRAMS DESCRIBED IN THIS DOCUMENT ARE CONFIDENTIAL INFORMATION
AND PROPRIETARY PRODUCTS OF APOLLO COMPUTER INC. OR ITS LICENSORS.
Reader__Notice This document resides online in the /install/doc/apollo
directory. You may print the online copy of this document by using one of
the following commands:
If your installation uses the System V lp print daemon, use an lp command
similar to the following:
lp -dprinter_name pathname
where pathname is the pathname of the release notes.
If your installation uses the Domain print system, use the following Aegis
/com/prf command:
prf pathname -pr printer_name -npag
If your installation uses the BSD lpd print daemon, use an lpr command
similar to the following:
lpr -P printer_name pathname
The pathname of this document is one of the following, depending on which
version of the compiler you have installed:
/install/doc/apollo/cc.v.6.7.m__notes
/install/doc/apollo/cc.v.6.7.p__notes
/install/doc/apollo/cc.v.6.7.mpx__notes
/install/doc/apollo/cc.v.6.7.pmx__notes
iii
Contents
Section
CHAPTER 1 OVERVIEW OF DOMAIN/C COMPILER VERSION 6.7 . . . . . . . . . . 1-1
1.1 Compiler Versions . . . . . . . . . . . . . . . . . . . 1-1
1.2 Inline Expansion of Functions . . . . . . . . . . . . . 1-2
1.2.1 Two Ways to Specify Inline Expansion . . . . . . . 1-2
1.2.2 Using #pragma Directives . . . . . . . . . . . . . 1-2
1.2.3 Information Messages . . . . . . . . . . . . . . . 1-3
1.3 Support for ANSI Keywords: const, signed, and volatile . 1-4
1.3.1 const . . . . . . . . . . . . . . . . . . . . . . 1-4
1.3.2 signed . . . . . . . . . . . . . . . . . . . . . . 1-5
1.3.3 volatile . . . . . . . . . . . . . . . . . . . . . 1-5
1.4 BUILTINS Macro . . . . . . . . . . . . . . . 1-6
1.5 Series 10000 Compiler Options: -prasm and -nprasm . . . 1-7
1.6 Compiler Options for ANSI Features: -xansi, -nansi,
and -nstdc . . . . . . . . . . . . . . . . . . . . . . 1-7
1.7 The -nclines Compiler Option . . . . . . . . . . . . . 1-8
1.8 New Syntax for the __attribute Modifier . . . . . . . . 1-8
1.9 Compatibility with NFS (Network File System). . . . . . 1-9
1.10 The long float Data Type . . . . . . . . . . . . . . . .1-10
1.11 The -bx Compiler Option . . . . . . . . . . . . . . . .1-10
CHAPTER 2 INSTALLATION INFORMATION. . . . . . . . . . . . . . . . . . . 2-1
2.1 Installation of Libraries. . . . . . . . . . . . . . . . 2-2
2.1.1 For Series 10000 Workstation Targets . . . . . . . 2-2
2.1.2 For Targets Other Than Series 10000 Workstations . 2-2
CHAPTER 3 DOCUMENTATION . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.1 The -M option for /bin/cc . . . . . . . . . . . . . . . 3-1
3.2 The -A Option for /bin/cc . . . . . . . . . . . . . . . 3-1
3.3 The -cpu fpa1 and -A cpu,fpa1 Options. . . . . . . . . . 3-2
3.4 The -frnd Compiler Option . . . . . . . . . . . . . . . 3-3
3.5 The builtins.h Header File . . . . . . . . . . . . . . . 3-4
3.6 The -compress and -ncompress Options . . . . . . . . . . 3-4
3.7 The #elif directive . . . . . . . . . . . . . . . . . . 3-5
3.8 The -l Compiler Option . . . . . . . . . . . . . . . . . 3-5
3.9 Nesting #include Files . . . . . . . . . . . . . . . . . 3-5
CHAPTER 4 BUGS AND BUG FIXES. . . . . . . . . . . . . . . . . . . . . . 4-1
4.1 Fixed APRs and Fixed Bugs .. . . . . . . . . . . . . . . 4-1
4.2 Known APRs and Bugs . . . . . . . . . . . . .. . . . . . 4-3
Contents iv
CHAPTER 1
OVERVIEW OF DOMAIN/C COMPILER
This document describes the features of Domain/C that are new in Version
6.7. In addition to adding new features, the Series 10000 (TM) compilers
generate significantly better code, run faster, and they use less disk
space.
This chapter covers the following:
o Compiler versions
o Inline expansion of functions
o Support for ANSI keywords: const, signed, and volatile
o BUILTINS Macro
o Series 10000 compiler options: -prasm and -nprasm
o Compiler options for ANSI features: -xansi, -nansi, and -nstdc
o The -nclines compiler option
o New syntax for the __attribute modifier
o Compatibility with the Network File System (NFS)*
o The long float data type
o The -bx Compiler Option
For more information about the Domain/C compiler, consult the Domain/C
Language__Reference (Order No. 002093).
1.1 Compiler Versions
Table 1-1 lists the four Domain/C Version 6.7 compilers. Where the compilers
differ from one version to another, we describe each compiler separately;
otherwise, you can assume the compilers are the same for all four versions.
______________________________________________________________________________
*NFS is a trademark of Sun Microsystems, Inc.
Version 6.7 1-1 Domain/C Compiler
Table_1-1.__Domain/C_Compiler_Versions
Compiler Version Runs_on Generates
680x0 native 6.7.m 680x0-based 680x0 code
compiler workstation
Series 10000 6.7.p Series 10000 Series 10000
native compiler workstation code
Cross compiler 6.7.mpx 680x0-based Series 10000
workstation code
Cross compiler 6.7.pmx Series 10000 6800x code
workstation
1.2 Inline Expansion of Functions
Domain/C allows you to specify that functions be expanded inline. Inline
expansion means that the compiler will attempt to generate code for the
function everywhere the function is referenced from within the same source
file. Inline expansion might create a larger object file, since the code for
the function is replicated at each call site. However, inline expansion may
result in an increase in execution speed. Usually, good candidates for
inline expansion are small functions that are frequently executed.
1.2.1 Two Ways to Specify Inline Expansion
You can use either of the following methods to tell the compiler to use
inline expansion:
o If you use -opt 3, which is the default, in combination with the
#pragma directives described in the next subsection, you can specify
exactly which routines are to be expanded inline. The inline #pragma
directives have no effect with -opt 0, -opt 1, or -opt 2.
o If you use -opt 4, the compiler performs the same inline expansion
as -opt 3. In addition, the compiler selects routines for inline
expansion whether or not you specify any routine with the #pragma
directives (See Section 1.2.2).
1.2.2 Using pragma Directives
A #pragma directive is an instruction to the compiler. The #pragma syntax
provides a portable syntax that allows you to use compiler-specific
directives.
You can cause a function to be inline expanded by compiling with either -opt
Version 6.7 1-2 Domain/C Compiler
3 or -opt 4 and also using the following #pragma compiler directives:
#pragma begin_inline /* expand routines defined on subsequent lines */
#pragma end_inline /* stop expanding routines */
#pragma begin_noinline /* do not expand routines defined on subsequent lines*/
#pragma end_noinline /* stop the effect of begin_noinline */
You cannot nest these #pragma compiler directives, and you must have matching
pairs to begin and end the specification.
For example, the following code fragment tells the compiler to expand the
tobeexpanded function wherever it occurs in the code.
#pragma begin_inline
int to_be_expanded (int a, int b )
{
int x = a, y = b;
printf("\nx is %d and y is %d\n",x,y);
}
#pragma end_inline
The following code fragment tells the compiler not to use inline expansion
for the notexpanded function under any circumstances.
#pragma begin_noinline
int not_expanded ()
{
int i;
for (i=1;i<=100;i++) printf("\ni is %d\n",i);
}
#pragma end_noinline
The compiler detects recursion and will not use inline expansion if doing so
would cause the compiler to loop indefinitely.
1.2.3 Information Messages
If you use the -info 4 compiler option, the compiler generates a list of
expanded routines. For example, if you compile a program containing the
tobeexpanded function (shown in the previous example) with -info 4, you get
the following message at compile time:
******** Line 38: [Information 266] routine expanded INLINE at
call site: "to_be_expanded".
This message indicates that the compiler substituted an expansion of
tobeexpanded at line 38 of your source file, where your source code
contained a function call to the tobeexpanded function.
Version 6.7 1-3 Domain/C Compiler
1.3 Support for ANSI Keywords: const, signed, and volatile
At this release, Domain/C supports the const, signed, and volatile keywords
as defined by the ANSI standard. The following subsections describe these
keywords.
1.3.1 const
Use const to specify that an object of any type must have a constant value
throughout the scope of its name. To declare such an object use the const
specifier before its type.
For example,
const float factor = 2.54; /*declare factor as a constant float*/
const struct
{
char a;
int b;
} S = { 'A',814 }; /*declare S as a constant struct*/
const int years[5] = { 1984, 1985, 1986, 1987, 1988 };
/*declare years as a constant array*/
Since you cannot assign values to them, constants must be initialized.
You can use a const declaration in many places where you might previously
have used a #define macro. Unlike constants created by #define macros which
are purely textual substitutions, const values have type, scope, and
visibility, like variables.
You can use the const keyword with pointers. When you use a pointer, you are
really using two objects--the pointer itself (which is an address) and the
object pointed to (the value stored at that address). If you prefix a
declaration of a pointer with the const keyword you make the value of the
object pointed to a constant; you do not make the pointer a constant. This
means that you cannot change the value stored at the location, but you can
vary the location designated by the pointer. To declare a pointer itself to
be a constant (rather than the object pointed to) use the * const
syntax.
For example,
const char * ptr_to_char_const ="abcd";
/* declare a pointer to a char constant; this means
the pointer may vary but *ptr_to_char_const cannot */
char * const constant_ptr_to_char = "abcd";
/* declare a constant pointer to a char; this means
the char may vary but the pointer cannot */
Version 6.7 1-4 Domain/C Compiler
main()
{
ptr_to_char_const = "efgh";
/* vary the pointer by pointing it to a char constant
at a different address */
ptr_to_char_const[0] = 'Q';
/* ERROR--you cannot change the value of the char
pointed to by ptr_to_char_constant */
constant_ptr_to_char[0] = 'Q';
/* OK to vary the char value since it's not constant */
constant_ptr_to_char = "efgh";
/* ERROR--you cannot vary the pointer object */
}
1.3.2 signed
Domain/C supports the signed keyword as defined by the ANSI standard. Use
the signed qualifier before a char or integer type to specify that the value
of the variable is to be represented internally with a sign bit as its
leftmost, or most significant, bit.
For example,
struct
{
signed char a;
signed int b :3;
} S;
As in prior releases of Domain/C, you can use the unsigned keyword to specify
that a char or integer type is stored without a sign bit.
The signed qualifier is particularly useful for controlling the storage of
character variables so that they can be accurately compared using relational
operators. Similarly, you can use the signed keyword to declare bit fields in
structures and control their internal representation.
1.3.3 volatile
Domain/C supports the volatile keyword as defined by the ANSI standard. Use
the volatile qualifier before any type declaration to specify that the value
of the variable might change in ways that the compiler cannot predict. This
prevents the compiler from executing certain optimizations.
Using the volatile keyword has the same effect as using the
attribute((volatile)) specifier, which is a Domain/C extension. See the
Domain/C______Language_____Reference manual for details about
attribute((volatile)). Also, see Section 1.8 of these release notes for
details about a change in the syntax for the attribute modifier.
Version 6.7 1-5 Domain/C Compiler
1.4 BUILTINS Macro
Domain/C supports a new macro, BUILTINS. If you define this macro on the
command line with the -def compiler option, the compiler accesses the most
recent macro definitions in the apollo/builtins.h header file. For example,
$cc trig.c -def BUILTINS
Using BUILTINS with the -def compiler option on the command line has the
same effect as using the following line in your source file:
#include <apollo/builtins.h>
The apollo/builtins.h header file enables built-in code generation for the
following mathematical functions:
abs()
sin()
cos()
tan()
log()
exp()
atan()
atan2()
sqrt()
The apollo/builtins.h header file enables built-in code generation for the
following string manipulation functions:
strcpy()
strncpy()
strncat()
strcat()
strcmp()
strncmp()
strlen()
Using BUILTINS can cause a significant performance benefit, although the
actual benefit varies according to your application. In general, the
performance benefit is most significant for programs that use the built-in
math functions. Using BUILTINS improves performance with strcpy() if the
string is relatively short or if the string is literal.
The built-in math functions do not support all the error-checking and
recovery that normally accompany library routines. Specifically, they do not
invoke the matherr function. You can define your own error handling
procedures by defining a matherr function. See the SysV__Programmer's
Reference (Order No. 005799) or the BSD_Programmer's_Reference (Order No.
005801) for details about including the matherr function in your code. If
your programs rely on this error handling, and if you do not define your own
error handling procedures, then you should not use the built-in routines.
Version 6.7 1-6 Domain/C Compiler
1.5 Series 10000 Compiler Options: -prasm and -nprasm
Domain/C now supports additional compiler options to give you control over
the format of expanded listings generated when you use the -exp option. You
should use these options only if you are generating Series 10000 code; that
is, you should use them only with Versions 6.7.p and 6.7.mpx. If you use
them with Version 6.7.m or Version 6.7.pmx, these options have no effect.
Also, if you use them without the -exp option, they have no effect.
The -prasm option is the default. This option tells the compiler to use the
Series 10000 assembly language format for the expanded listing it
generates.
The -nprasm option tells the compiler to use a format similar to the
680x0-based assembly language format for the expanded listing it generates.
Most programmers find this format easier to use when debugging a program.
Use these options with /com/cc by typing them on the command line. Use them
with /bin/cc by prefixing them with the -W0 option.
1.6 Compiler Options for ANSI Features: -xansi, -nansi, and -nstdc
Domain/C supports additional compiler options to give you more control over
the compiler's implementation of certain ANSI standard features. By ANSI
standard features we mean features defined by the ANSI committee that are
not part of the K and R (Kernighan and Ritchie) "standard."
The additional compiler options are the -xansi, -nansi, and -nstdc options;
Table 1-2 describes them.
Version 6.7 1-7 Domain/C Compiler
Table_1-2.__New_Domain/C_Compiler_Options_for_ANSI_Features
Compiler_Option Short_Definition What_It_Tells_the_Compiler_to_Do
-xansi (Extended ANSI) Use all ANSI features currently available;
also use all Domain extensions. The ANSI
features currently implemented are:
o Function prototyping
o const, volatile, and signed qualifiers
o STDC macro defined as 1
-nansi (No ANSI) Do not use any ANSI features.
-nstdc (No STDC) Set the value of STDC to be undefined
(as if by #undef). Use this option
along with -xansi if:
o Portions of your code use ANSI features
not yet implemented by Domain/C
o The unimplemented ANSI features are
contingent on STDC being defined
NOTE: The -xansi option is the default.
________________________________________________________________________________
Use these options with /com/cc by typing them on the command line. Use them
with /bin/cc by prefixing them with the -W0 option.
1.7 The -nclines Compiler Option
By default the compilers that generate code for the 680x0 workstations
generate COFF line number tables whenever you compile using the -dba or -dbs
options. However, the Domain debugger (Domain/DDE) does not require these
tables, nor does the Domain traceback (tb) tool. You can use the -nclines
option to tell the compiler to suppress the generation of these tables.
Since these tables might require a lot of disk space, you should use the
-nclines option if you do not need the COFF line number tables and you wish
to save space.
NOTE: This option has no effect on the compilers that generate code for
the Series 10000 workstations.
1.8 New Syntax for the __attribute Modifier
We have changed the name of the #attribute declaration modifier to
__attribute. Also, its syntax now uses double parentheses, for example,
((volatile)), instead of square brackets [].
As a result the format for using the __attribute declaration modifiers is as
Version 6.7 1-8 Domain/C Compiler
follows:
[specifier] data_type variable_name __attribute
((
address |
volatile |
device [( read | write | read, write )] |
section [ ( name_of_section )]
)) ;
For instance, if your program accesses FORTRAN common blocks and you compile
with /bin/cc, you may want to use the __attribute (( section )) modifier to
create an overlay section. Your declaration of the structure might be:
struct a_common {
int ivar;
int jvar;
} a_ __attribute((section(a_))); /* Note the change in syntax here */
See the Domain/C__Language__Reference for further details about using
__attribute modifiers.
1.9 Compatibility with NFS (Network File System)
Domain/C Version 6.7 is fully compatible with the Network File System (NFS).
You can redirect the binary output of the C compiler to a file on a remote
node that you have accessed using NFS, and you can then run the program on
the remote node.
In order to use this feature of Domain/C, you must have NFS installed on
your system.
For example, suppose you issue the following NFS mount command to gain access
to a remote node:
$ /etc/mount -o soft faraway:/ /othernode
This command, which you can issue in any shell, gives you access to the
entire directory structure of the remote node faraway. You can access this
directory structure as if it were a local directory named /othernode.
For instance, to compile the program test.c, place it in the directory /tmp
on the remote node and issue the cc command:
$ /bin/cc test.c -o /othernode/tmp/test.out
Then you can run the program as follows:
$ /othernode/tmp/test.out
You can also use the remote node directory as your working directory. If you
Version 6.7 1-9 Domain/C Compiler
do so, compiler options that use the name of the current working directory
work as usual.
For instance, you can use the Aegis -l option to generate a listing file, as
shown in the following sequence of commands (the example assumes you are
working in a UNIX* shell):
% /etc/mount -o soft faraway:/ /other_node
% cp ~/test.c /other_node/test.c
% cd /other_node
% cc -W0,-l test.c
.
.
.
% ls
.
.
.
test.lst
For more information about NFS see Using_NFS_on_the_Domain_Network (Order No.
10414).
1.10 The long float Data Type
The compiler no longer accepts long float as a synonym for double. If you
use long float, the compiler generates an error. This change is consistent
with the second edition of Kernighan and Ritchie, "The C Programming
Language".
1.11 The -bx Compiler Option
When you use /com/cc to invoke the compiler, by default, Domain/C appends
the .bin suffix to object files it generates. This is true even if you use
the -b option to name the file.
You can use the -bx compiler option to tell the compiler to name the object
file it generates without using the .bin suffix.
For instance, if you use the following command line, the compiler will name
the object file 'test'.
$ cc my_c_program.c -bx test
______________________________________________________________________________
*UNIX is a registered trademark of AT&T in the USA and other countries.
Version 6.7 1-10 Domain/C Compiler
CHAPTER 2
INSTALLATION INFORMATION
You can install the Domain/C Compiler Version 6.7 on a user node (one
equipped with monitor and keyboard) or a Domain Server Processor (DSP)
that is running SR10.0 or a more recent version of the Domain/OS
operating system.
For directions about how to install this product, see the manual
Installing___Software_with_Apollo's_Release_and_Installation_Tools, (Order
No. 008860-A00), as well as the hardcopy installation document that
accompanied your media. The hardcopy document is called Media
Installation_Instructions_for__Optional___Software__Products, (Order No.
010854-A04).
NOTE: For successful installation of these products, the workstation
must have enough available disk space to store them. See Table
2-1 for information about the space required. Also, note that
these compilers do not share disk space.
Table_2-1.__Domain/C_Disk_Space_Requirements
Compiler Version Blocks_Required_
680x0 native 6.7.m 2164
compiler
Series 10000 6.7.p 5887
native compiler
Cross compiler 6.7.mpx 4322
Cross compiler 6.7.pmx 3416
Compilers that run on different machine types but produce code for the
same machine type can have their release indexes merged using the mrgri
tool. For instance, the cc.p and the cc.mpx compilers can be merged,
yielding a cmpexe compiler that runs on any Apollo workstation and
produces code for the Series 10000 workstation.
For more information on mrgri see the SR10.1.p release notes: Domain
System Software Release Notes (005809-A04).
Version 6.7 2-1 Domain/C Compiler
2.1 Installation of Libraries
C programs require the correct version of the syslib system library
(stored in directory /lib) in order to run properly. If you have
already installed the Domain/OS operating system on your node, then your
node already has a version of syslib; however, this may not be the best
version. In addition, the release media for Version 6.7 of Domain/C
comes with a version of syslib. This section explains whether the
version of syslib already on your node is appropriate or whether you
should install the version of syslib that comes with the Domain/C
release media.
2.1.1 For Series 10000 Workstation Targets
If you are using Domain/C Version 6.7 to compile programs that will run
on a Series 10000 workstation (the target node), here is what to do:
o If the target node is running SR10.0.p, you should install the
syslib (Version 1.0.p) that comes on the Domain/C release
media. If you do not, then the run-time system will issue
"References to undefined global" errors if your program calls
base 10 logarithm extrinsic functions.
o If the target node is running SR10.1.p (or later), do not
install the syslib that comes with the Domain/C release media.
In other words, take no action because the syslib that came with
the operating system is correct. If you mistakenly install the
syslib that comes with the Domain/C release media, your node
will not boot.
2.1.2 For Targets Other Than Series 10000 Workstations
If you are using Domain/C Version 6.7 to compile programs that will run
on a node other than a Series 10000 workstation, here is what to do:
o If the target node is running SR10.0, you should install the
syslib (Version 1.0) that comes with the Domain/C release
media. If you do not, then the run-time system will report
errors if your source code attempts to convert a floating-point
value to an unsigned int, unsigned short, or unsigned char.
o If the target node is running SR10.1, you should install the
syslib (Version 1.0) that comes with the Domain/C release
media. If you do not, and you compile with the -cpu FPA1
switch, then the run-time system will report errors if your
Version 6.7 2-2 Domain/C Compiler
source code attempts to convert a floating-point value to an
unsigned int, unsigned short, or unsigned char.
o If the target node is running SR10.2 or later, do not install
the syslib that comes with the Domain/C release media. In other
words, take no action because the syslib that came with the
operating system is the appropriate one.
NOTE: If you are writing Domain/C programs for users who will run
them on SR10.0 workstations, you can provide these users with
the required syslib by using static binding.
Version 6.7 2-3 Domain/C Compiler
CHAPTER 3
DOCUMENTATION
The most recent version of the Domain/C__Language__Reference (Order No.
002093-A00) describes the Domain/C language at SR10. This chapter
describes modifications to that document.
3.1 The -M option for /bin/cc
In previous versions of the Domain/C compiler, the -M option to the
/bin/cc interface was used to identify the target machine (similar to
-cpu for the /com/cc interface). At SR10 and later releases, -M is a
preprocessor option that directs the compiler to run only the macro
preprocessor on the named C programs, and to generate makefile
dependencies and send the result to the standard output. Use the new -A
option (described in Section 3.2) to select a target machine type.
3.2 The -A Option for /bin/cc
The -A option identifies certain Domain extensions to the compiler:
-A nansi Do not compile with ANSI rules. This option passes -ntype to
the compiler, and does not define the preprocessor symbol
STDC. See the Domain/C_Language_Reference for details
about function prototypes.
-A cpu,id Generate code for a particular class of processor; the default
id is any. Values for id are as follows:
any Series 10000 code, if you're
compiling on a Series 10000
workstation, or 680x0 code, if
you're compiling on a
680x0-based workstation
a88k Series 10000 code
Version 6.7 3-1 Domain/C Compiler
m68k 680x0-based code
160 DSP160 code
460 DSP460 code
660 660 code
90 DSP90 code
330 DN330 code
560 DN560 code
570 DN570 code
580 DN580 code
3000 DN3000, DN3500, DN4000, and DN4500 code
FPA1 FPA Floating-Point Accelerator Board
FPX Floating-Point Accelerator Board
PEB Performance Enhancement Board
The following values for id are synonyms: 160, 460, and 660. Also, the
following values for id are synonyms: 90, 330, 560, 570, 580, and 3000.
Using a processor-specific code generation mode can result in programs
that run faster.
-A sys[type],sys
Define sys, the target system type, for the compiled object;
sys may be one of the following:
any Version independent
bsd4.1 Berkeley version 4.1 (obsolete)
bsd4.2 Berkeley version 4.2
bsd4.3 Berkeley version 4.3
sys3 UNIX System III (obsolete)
sys5 UNIX System V
sys5.3 UNIX System V Release 3
This option replaces the -Tsystype option (which is supplied
for backwards compatibility).
-A run[type],sys
Like -A sys[type],sys this option passes runtype information to
the compiler and linker.
3.3 The -cpu fpa1 and -A cpu,fpa1 Options
The -cpu fpa1 option is for use with the /com/cc interface, whereas the
-A cpu,fpa1 option is for use with the /bin/cc interface. These options
direct the compiler to produce optimized code for the Floating-Point
Accelerator (FPA) board that is available with Series 4000 (TM)
workstations. Use of this switch can produce substantially faster
Version 6.7 3-2 Domain/C Compiler
code. Do not use this switch, however, if the target machine does not
have an FPA board.
3.4 The -frnd Option
The -frnd ("float rounds") option is available only with the /com/cc
interface to the C compiler. If you are using the /bin/cc interface,
you need to use the -W compile switch, as in:
$ /bin/cc -W0,-frnd foo.c
The -frnd option forces the compiler to write all floating-point operands
to memory and then fetch the memory contents before evaluating the
expression. This ensures that each operand will have the same amount of
precision so that floating-point comparisons will produce correct
results. If you do not compile with -frnd, floating-point operands may
be kept in registers, which support more accuracy than memory.
Consequently, when a register operand is compared with a memory operand,
the result may not be what is expected. This is particularly true of
equality comparisons. Consider the following C program:
double fetch( void )
{
return 1.1;
}
int main( void )
{
double x;
x = fetch();
if (x - 0.1 == 1.0)
printf( "Pass\n" );
else
printf( "Fail\n" );
}
If you compile with -cpu 3000 (or -A cpu,3000 if you are using /bin/cc)
and without -frnd, this program fails because the values 0.1 and 1.1
cannot be represented exactly in base 2 floating-point. Thus, the
quantity (x - 0.1) can only be approximated. This value is calculated in
an 80-bit register, and then a compare is generated to see if this value
is exactly equal to 1.0, which is stored in memory. Since the register
has more accuracy than memory, the comparison fails.
If you compile with -frnd, the 80-bit register is stored (and rounded)
in a single-precision 32-bit temporary memory location. Now when it is
compared with 1.0, which is also stored in memory, the comparison
Version 6.7 3-3 Domain/C Compiler
passes.
Compiling with -frnd could mean that your program will run slower, so we
recommend that you use -frnd only when necessary.
The -frnd and -nfrnd options have no meaning if you are compiling code
for a Series 10000 workstation.
3.5 The builtins.h Header File
Page 6-47 of the Domain/C_Language_Reference states that you must include
<builtins.h> to get the inline versions of certain functions. The
correct notation for including this header file is:
#include <apollo/builtins.h>
3.6 The -compress and -ncompress Options
Domain compilers can store data in the object file in either compressed
or uncompressed form. With uncompressed data, the object file contains
an exact image of the data as they will be loaded into memory. In
compressed form, the object file contains instructions to the loader that
describe how to load the data into memory.
Compressed data can save space in the object file. Consider, for
example, an array of 100 bytes all initialized to zero. Stored in
uncompressed form, this array occupies 100 bytes in the object file. In
compressed form, the array occupies only enough space for a single .rwdi
instruction: load 100 bytes with value 0.
Before Versions 6.6.m and 6.6.pmx, Domain/C compilers stored all data in
uncompressed form.
To link a module with compressed data to a module with uncompressed data,
the linker expands the compressed data. The linker's output file then
contains uncompressed data from two modules and the .rwdi instructions
from the compressed module. The output file is even larger than it would
have been if both compilers had stored the data in uncompressed form.
To avoid this problem, Domain/C now allows you to specify whether the
compiler stores the data in compressed or in uncompressed form. The
-ncompress option (the default for Domain/C) stores data in uncompressed
form; the -compress option stores all data in compressed form. If
neither -compress nor -ncompress is specified, the compiler will compress
all data sections except the one called ".data". This differs from the
behavior of the Pascal and FORTRAN compilers, which compress everything
by default.
Version 6.7 3-4 Domain/C Compiler
3.7 The elif directive
The current Domain/C Language Manual states incorrectly on page 4-99 that
the #elif directive is supported by the UNIX preprocessor (cpp).
Instead the manual should state the following:
There are three preprocessors; one is for Aegis, one is for BSD
and one is for SysV. The Aegis and BSD preprocessors do not
support the #elif directive, but the SysV preprocessor
does support the #elif directive.
3.8 The -l Compiler Option
In the description of the /bin/cc compiler option -l on page 6-8, the
following sentence is incorrect:
The link editor searches for libraries in the directories specified
by the environment variables LIBDIR and LLIBDIR (these generally
resolve to /lib and /usr/lib).
The sentence should read instead,
By default, the link editor searches for libraries first in the
directory /lib, then in /usr/lib.
3.9 Nesting include Files
The manual has two sentences about nesting #include files that are
incorrect.
On page 4-103 the manual incorrectly states that "The Domain preprocessors
support up to 12 levels of nested header files." Also, on page 9-9 it
states "there can be no more than 16 levels of header files."
Instead, the manual should state the following: "The /bin/cc interface allows
8 levels of nesting of include files, and the /com/cc interface allows 16
levels of nesting of include files."
Version 6.7 3-5 Domain/C Compiler
CHAPTER 4
BUGS AND BUG FIXES
This chapter describes known bugs and bugs that were fixed since the last
release of the compiler.
4.1 Fixed APRs and Fixed Bugs
The APRs (Apollo Product Reports) with the following numbers have been
fixed:
DC6C2
Under certain circumstances, a run-time error occurred because the
compiler did not access array elements correctly.
D882871
The compiler incorrectly generated an error for an initialization of
an aggregate within an aggregate within an aggregate.
D885781
The compiler did not correctly promote the types of arguments used
with the conditional (?:) operator.
DC7F9
The compiler did not understand a directory of type nfs_gate. See
Section 1.9 of these notes for details about a new compiler feature
that addresses this limitation.
DC800
The compiler did not allow elements of a structure passed as a
reference argument to be accessed with the dot (.) operator.
Version 6.7 4-1 Domain/C Compiler
DC867
The UNIX preprocessors did not accept #pragma.
DCB40
A problem with the 'named sections' attribute caused the /bin/cc
interface to the compiler to generate code accessing a FORTRAN COMMON
block to fail at run time.
DCCC2
The Series 10000 target compilers failed when processing an
expression consisting of a function call returning a structure used
as the argument to another function call.
DCC7D
The compiler generated an error message that it "lost value of node"
when attempting to compile a particular piece of code using a
pointer to an array index as an argument to the conditional (?:)
operator.
DBE2D
The compiler did not accept function names in conditional (?:)
expressions.
DC28E
The compiler performed incorrect type checking when evaluating the
address of zero as a constant value.
DC452
The compiler failed when trying to process a particular piece of code
using reference variables and -opt 3.
DCC40
The compiler did not correctly compute the number of temporary
registers needed to compute an expression.
DCFD8
The code generator failed to check for a parameter to gpr being in an
assigned register.
DD0EB
Bit field assignments were incorrect.
Version 6.7 4-2 Domain/C Compiler
DC452
The compiler tried to use too many registers when processing the MOD
operator.
DC705
The compiler generated a "no temp created" error message when the
optimizer was on.
DD1F7
A return statement in a very large routine containing no static or
external references did not always work.
The following bugs have been fixed:
o If you called strncmp(a,b,c) where c is a local variable assigned to
a register, the inlined code for strncmp caused c to be set to zero.
o Bad code was generated for copying to a structure returned by a
function. When using code of the form
*f() = s;
where s is a structure greater than 8 bytes, and f returns a pointer
to a structure, nothing was assigned.
o The Domain/C compiler generated error messages that show line
numbers greater than 9999 using only the last 4 digits of the
number.
4.2 Known APRs and Bugs
The following APRs (Apollo Product Reports) have not yet been fixed:
DCE3B
Under certain conditions, programs that contain mixtures of old-style
and new-style function declarations can pass function arguments
incorrectly. You can avoid the problem by using either ALL old-style
or ALL new-style declarations.
DC80F
If your code contains a function returning a structure and you
compile using -opt 3, the compiler may generate incorrect run-time
results; the workaround is to compile using -opt 0.
Version 6.7 4-3 Domain/C Compiler
DD101
The optimizer does not correctly handle unused parameters that have
values assigned to them within an argument list.
The following bugs are known:
o There is a problem with precedence of operators. The precedence of
++ and casting are the same and they work from right to left.
However, the following program does not compile the casting after
'++'; the compiler takes it as being an expression.
main ()
{
unsigned char *pt;
short this;
this = *++(short *)pt;
}
This generates the following errors:
error 116 improper expression; "short" found
error 116 improper expression; ")" found.
o The -esf option suppresses the -info option. Using both options
generates a message that there are informational messages, but it
does not display those messages.
o When you use /bin/cc in a BSD environment, the compiler interface
does not recognize the -P option.
o The Domain/C compiler generates source code listing files that show
line numbers greater than 9999 using only the last 4 digits of the
number.
o When you use the Domain Distributed Debugging Environment
(Domain/DDE) to step through a program, the debug information
created by the C compiler sometimes causes the line pointer to jump
over program lines where it would normally be expected to stop.
o If you use the Domain Distributed Debugging Environment (Domain/DDE)
to step through code in an included file that contains executable
code, the debugger may not show the correct routine name and line
number information.
o If you use /bin/cc in a SysV environment, static uninitialized data
is sometimes allocated in .data rather than .bss.
Version 6.7 4-4 Domain/C Compiler
o If you compile with -cpu 160, -cpu 460, or -cpu 660, operations using
the % operator on 32-bit quantities do not work. You can avoid this
problem by compiling with -cpu any, which is the default.
Version 6.7 4-5 Domain/C Compiler