This document contains last minute information about the Sun WorkShop 6
C compiler. It describes the software corrections addressed by this release and lists the known problems, limitations, and incompatibilities.
You can view the text version of this document by typing the following
at a command prompt:
To access the HTML version of this document, point your Netscape(TM) Communicator 4 or compatible Netscape version browser to:
About Sun WorkShop 6 C Compiler
New Features
Software Corrections
Problems and Workarounds
Limitations and Incompatibilities
Documentation Errata
| |
A. About
Sun WorkShop 6 C Compiler
The Sun WorkShop 6 C compiler (cc) runs on the Solaris(TM) Operating
Environment (SPARC(TM) Platform Edition) and Solaris(TM) Operating Environment
(Intel Platform Edition) versions 2.6, 7, and 8. Information
unique to one or more platforms is identified as "(SPARC)" or "(IA)."
This compiler is fully compliant with the ANSI/ISO C language and
environment standard (ANSI/ISO 9899-1990), and it also supports traditional
K&R C.
The 64-bit SPARC architecture features in this release provide support
for the C International Standard and for -xarch=v9.
B. New Features
This release of the Sun WorkShop 6 C compiler supports
the following new features:
-
Incremental Link Editor Chapter
This version of the C User's Guide includes a full chapter about
the incremental link editor.
-
__func__
The C compiler now predefines a static, constant, char
array named __func__ for every function definition.
The array is initialized with the name of the function and
can be used anywhere a static function scope array can be
used, such as when printing the name of the enclosing function.
-
Variable argument macro
You can now issue a #define preprocessor directive
in the following form:
#define <identifier> (...) <replacement-list> new-line
#define <identifier> (<identifier-list> , ...)
<replacement-list> new-line
The C preprocessor accepts a variable number of arguments for a
#define preprocessor directive. If the macro definition
includes an ellipsis as part of the identifier list, then there
will be more arguments when the macro is invoked then there were
parameters in the macro definition.
-
SUNW_MP_THR_IDLE
You can now use the SUNW_MP_THR_IDLE
environment variable to control whether a thread
continues to use system resources after it finishes its task or it "sleeps."
-
Large arrays
The C compiler now supports significantly larger array objects.
For specifics, see Appendix A of the C User's Guide.
-
-errchk=locfmtchk
lint now accepts a new flag, -errchk=locfmtchk, that
checks for printf-like format strings during lint's first pass.
-
New lint directive (PRINTFLIKE(n))
lint now accepts a new directive that identifies all calls to
the printf() family through a pointer. All such
calls through the pointer can now be checked for argument
consistency by lint.
-
-errwarn=t
The C compiler and the lint source code checker now support a new option
-errwarn=t, which causes the compiler to exit with a failure status if any of the specified warnings are issued.
-
-errchk
The -errchk option of lint now has a new value
signext that you can use in conjunction with the
longptr64 option: -errchk=longptr64,signext.
This new option warns about sign extension in order to facilitate
migration to the 64-bit development environment.
-
-xchar_byte_order
The -xchar_byte_order option produces an integer constant by placing the characters of a multi-character character-constant in the specified byte order.
-
-xinline
The -xinline option now accepts two new values:
%auto and no%function_name.
The %auto value takes effect at the -x04
level of optimization and allows the compiler
to automatically inline functions in addition to
those listed in -xinline. The no%function_name
value tells the compiler to not inline the function
function_name.
-
-xmemalign
The C compiler now offers a new option called -xmemalign. This option controls code generated for potentially misaligned memory accesses and controls program behavior in the event of a misaligned access.
-
-xprefetch
SPARC only - You can use the new option
-xprefetch, in conjunction with the header
file, sun_prefetch.h to specify prefetch
instructions on those architectures that support
prefetch, such as UltraSPARC II.
-
-xvector
The -xvector option enables automatic generation of calls to the vector library functions.
C. Software Corrections
There is no new information at this time.
D. Problems and Workarounds
This section discusses the following software bugs that could not be
fixed in time for this release. Check
Hot News for Sun WorkShop 6
(http://www.sun.com/workshop/users/ws.html)
for updated information.
Intel Only
On Solaris 2.6 and 7, you need a patch to correctly
divide two values of type long long. Visit
http://sunsolve.Sun.COM
and search for a patch that fixes any of these bugs: 4291587, 4170068.
- Example 1 of this problem:
#include
main(int argc, char **argv)
{
unsigned long long a, b, c;
b = 14767657705731979164;
c = 8930435072;
a = b % c;
printf("%llu %llu %lld\n", a, b, c);
}
/opt/SunWSpro/bin/cc:
outputs: 18446567979202000796 14767657705731979164 8930435072
Here is the correct output:
outputs : 4741633948 14767657705731979164 8930435072
- Example 2 of this problem:
----------------------
test.c
----------------------
#include
#include
#define A (15683869288531500908ULL)
#define B (193107421370ULL)
#define C (81218366ULL)
unsigned long long get_a() { return A; }
unsigned long long get_b() { return B; }
unsigned long long getresult() { return get_a()/get_b(); }
int main()
{
printf("%llu / %llu : compiler evaluation: %llu run-time evaluation: %llu expected: %llu\n",
A,
B,
A / B, /* evaluated at compile time */
getresult(), /* evaluated at run-time when we compile w/o optimization */
C);
}
Output from Intel compiler:
15683869288531500908 / 193107421370 : compiler evaluation: 81218404 run-time evaluation: 81218404 expected: 81218366
Here is the correct output:
15683869288531500908 / 193107421370 : compiler evaluation: 81218366 run-time evaluation: 81218366 expected: 81218366
E.
Limitations and Incompatibilities
There is no new information at this time.
F. Documentation Errata
-
The description for #pragma opt level
(funcname[, funcname])
should read as follows:
The value of level specifies the optimization level
for the funcname subprograms. You can assign the following
value to level:
0, 1, 2, 3,
4, 5. You can turn off optimization
by setting level to 0. The funcname subprograms
must be prototyped prior to the pragma. The level of optimization
for any function listed in the pragma is reduced to the value of
-xmaxopt. The pragma is ignored when -xmaxopt=off.
-
The C User's Guide does not mention generic64 and
native64
as possible settings for -xtarget,
-xarch,
and -xchip. See the cc(1) man page for
details.
Copyright 2000 Sun Microsystems, Inc.,
901 San Antonio Road, Palo Alto, CA 94303, U.S.A. All rights reserved.
Sun, Sun Microsystems, the Sun logo, docs.sun.com, and Solaris are
trademarks, registered trademarks, or service marks of Sun Microsystems,
Inc. in the U.S. and other countries.