Updated 2001/06/07

Sun WorkShop[tm] 6 update 2 C Compiler Readme


Contents

  1. Introduction
  2. About the C Compiler
  3. New Features
  4. Software Corrections
  5. Problems and Workarounds
  6. Limitations and Incompatibilities
  7. Documentation Errata

A. Introduction

This document contains last-minute information about the C compiler. This document describes the software corrections addressed by this release and lists known problems, limitations, and incompatibilities.

For installation-related and late-breaking information about this release, see the Sun WorkShop 6 update 2 Release Notes. Information in the release notes overrides information in all readme files.

To access the release notes and the full Forte[tm] Developer/Sun WorkShop[tm] documentation set, point your Netscape[tm] Communicator 4.0 or compatible browser to the documentation index (file:/opt/SUNWspro/docs/index.html).

To view the text version of this readme, type the following at a command prompt:

   example% cc -xhelp=readme

To access the HTML version of this readme, point your Netscape Communicator 4.0 or compatible browser to:

   file:/opt/SUNWspro/docs/index.html

Note - If your Sun WorkShop software is not installed in the /opt directory, ask your system administrator for the equivalent path on your system.


B. About the C Compiler

The Sun WorkShop 6 update 2 C (cc) compiler runs on SPARC[tm] processors running Solaris[tm] SPARC Platform Edition, and Intel processors running Solaris 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 development release are support for the C International Standard and for -xarch=v9.


C. New Features

This section describes the new and changed features for this release of the Sun WorkShop 6 update 2 C compiler. In addition, it lists the new features that were introduced in the Sun WorkShop 6 and Sun WorkShop 6 update 1 releases of the C compiler.

  1. Sun WorkShop 6 update 2 New Features
  2. Sun WorkShop 6 update 1 New Features
  3. Sun WorkShop 6 New Features
  1. Sun WorkShop 6 update 2 New Features

    The Sun WorkShop 6 update 2 C compiler includes the following new and changed features.

    1. Interprocedural Optimization (-xipo) (SPARC)
    2. OpenMP (SPARC)
    3. Lint Support for Type-based Alias-Analysis
    4. Code Set Independence Via -xcsi
    5. Partial Support for C99 Standard
    6. Lint Support for Implemented C99 Features
    7. Identifying Whether a Plain char Is Signed
    8. New and Changed Values for -xchip and -xtarget


    1. Interprocedural Optimization (-xipo) (SPARC)

      This new compiler flag performs whole-program optimizations by invoking an interprocedural analysis pass. Unlike -xcrossfile, -xipo performs optimizations across all object files in the link step, and is not limited to just the source files on the compile command.

      -xipo is particularly useful when compiling and linking large multi-file applications. Object files compiled with this flag have analysis information compiled within them that enables interprocedural analysis across source and pre-compiled program files. However, analysis and optimization is limited to the object files compiled with -xipo, and does not extend to object files in the libraries.

      -xipo is multiphased, so you need to specify -xipo for each step if you compile and link in separate steps.

      In this example, compilation and linking occur in a single step:

      cc -xipo -xO4 -o prog  part1.c part2.c part3.c
      
      The optimizer performs crossfile inlining across all three source files. This is done in the final link step, so the compilation of the source files need not all take place in a single compilation and could take place over a number of separate compilations, each specifying -xipo.

      In this example, compilation and linking occur in separate steps:

      cc -xipo -xO4 -c part1.c part2.c 
      cc -xipo -xO4 -c part3.c
      cc -xipo -xO4 -o prog  part1.o part2.o part3.o
      

      The object files created in the compilation steps have additional analysis information compiled within them to permit crossfile optimizations to take place at the link step.

      A restriction is that libraries, even if compiled with -xipo do not participate in crossfile interprocedural analysis, as shown in this example:

      cc -xipo -xO4 one.c two.c three.c
      ar -r mylib.a one.o two.o three.o
      ...
      cc -xipo -xO4 -o myprog main.c four.c mylib.a
      

      Here interprocedural optimizations are performed between one.c, two.c and three.c, and between main.c and four.c, but not between main.c or four.c and the routines on mylib.a. (The first compilation may generate warnings about undefined symbols, but the interprocedural optimizations are performed because it is a compile and link step.)

      Other important information about -xipo:

      • It requires an optimization level of at least -xO4.
      • It conflicts with -xcrossfile. If you use these together, the result is a compilation error.
      • Objects that are compiled without -xipo can be linked freely with objects that are compiled with -xipo.


    2. OpenMP (SPARC)

      This release of the C compiler implements the OpenMP interface for explicit parallelization including a set of source code directives, run-time library routines, and environment variables with the following new option:

      cc -xopenmp

      Note: If you issue the -xopenmp option and optimization is not at -xO3 or higher, optimization is raised to -xO3 and a warning is issued.

      You can view the OpenMP specifications at http://www.openmp.org/specs  (Parallelization features require a Forte for High Performance Computing (HPC) license.)

    3. Lint support for type-based alias-analysis

      The Lint program now support type-based alias-analysis through the following command:

      • -Xalias_level[=l]

      This option has the same defaults and arguments as cc -xalias_level. See cc.1 or The C User's Guide for more information.

    4. Code Set Independence Via -xcsi

      -xcsi

      Allows the C compiler to accept source code written in locales that do not conform to the ISO C source character code requirements. These locales include: ja_JP.PCK.

      Note, the compiler translation phases required to handle such locales may result in significantly longer compile times. You should only use this option when you compile source files that contain source characters from one of these locales.

      The compiler does not recognize source code written in locales that do not conform to the ISO C source character code requirements unless you issue -xcsi.

    5. Partial Support for C99 Standard

      The -xc99 flag controls compiler recognition of the implemented features from the C99 standard (ISO/IEC 9899:1999, Programming Language - C).

      -xc99=[%all|%none]

      If you issue -xc99 without =%none, the compiler assumes -xc99=%all. -xc99=%all turns on recognition of the C99 features implemented so far.

      Sun WorkShop 6 update 2 supports the following C99 features:

      • C99 Keywords

        The C99 standard introduces the following new keywords:

        • inline
        • restrict
        • _Imaginary
        • _Complex
        • _Bool

        The compiler issues a warning if you use these keywords as identifiers while compiling with -xc99=%none. Without -xc99=%none the compiler issues a warning or an error message for use of these keywords as identifiers depending on context.

      • __func__ Support
      • The compiler provides support for the predefined identifier __func__ .

      • Variable Length Arrays

        VLAs are allocated on the stack as if by calling the alloca function. Their lifetime, regardless of their scope, is the same as any data allocated on the stack by calling alloca; until the function returns. The space allocated is freed when the stack is released upon returning from the function in which the VLA is allocated.

        The compiler provides C99 support for Varaible Length Arrays. Not all constraints are yet enforced. Constraint violations will lead to undefined results.

      • inline Specifier For Static Functions

        The C99 function-specifier inline has been added. inline is fully functional for functions with internal linkage. For functions defined with external linkage use of the inline function-specifier creates an inline definition only, no external definition of the function is created. Thus pointers to inline functions with external linkage are unique to each translation unit and will not compare equal.

      • Commenting Code With //

        Code preceeded by a set of forward slashes is recognized as a comment when you issue -xc99=%all. One set of forward slashes is required per line of commentary.

    6. Lint Support for Implemented C99 Features

      lint's -Xc99 flag enables you to check whether or not your code is properly calling supported C99 featues.

    7. Identifying Whether a Plain char Is Signed

      The -xchar[={signed|s|unsigned|u}] option is provided solely for the purpose of easing the migration of code from systems where the char type is defined as unsigned. Do not use this option unless you are migrating from such a system. Only code that relies on the sign of a char type needs to be rewritten to explicitly specify signed or unsigned.

      signed Treat character constants and variables declared as char as signed. This impacts the behavior of compiled code, it does not affect the behavior of library routines.
      s Equivalent to signed
      unsigned Treat character constants and variables declared as char as unsigned. This impacts the behavior of compiled code, it does not affect the behavior of library routines.
      u Equivalent to unsigned

      If you do not specify -xchar, the compiler assumes -xchar=s. If you specify -xchar, but do not specify a value, the compiler assumes -xchar=s.

      The -xchar option changes the range of values for the type char only for code compiled with -xchar. This option does not change the range of values for type char in any system routine or header file. In particular, the value of CHAR_MAX and CHAR_MIN, as defined by limits.h, do not change when this option is specified. Therefor, CHAR_MAX and CHAR_MIN no longer represent the range of values encodable in a plain char.

      If you use -xchar, be particularly careful when you compare a char against a predefined system macro because the value in the macro may be signed. This is most common for any routine that returns an error code which is accessed through a macro. Error codes are typically negative values so when you compare a char against the value from such a macro, the result is always false. A negative number can never be equal to any value of an unsigned type.

      It is strongly recommended that you never use -xcharto compile routines for any interface exported through a library. By default, the C compiler defines char as signed as per the Solaris ABI and -xchar does not change that. Therefore, any users of such a library needs to be cautioned to also use this option or otherwise deal with any char values being passed or returned.

    8. New and Changed Values for -xchip and -xtarget

      The -xchip option now accepts the value ultra2e for specifying the UltraSPARCIIe processor.

      Also the implied -xarch setting for the following -xtarget values has changed from v8 to v8plusa:

      • entr2/1170
      • entr2/1200
      • entr2/2170
      • entr2/2200
      • entr3000
      • entr4000
      • entr5000
      • entr6000
      • ultra
      • ultra/140
      • ultra/170
      • ultra/200
      • ultra2
      • ultra2/1170
      • ultra2/1200
      • ultra2/1300
      • ultra2/2170
      • ultra2/2200
      • ultra2/2300
      • ultra2e
      • ultra2i
      • ultra3


  2. Sun WorkShop 6 update 1 New Features

    Sun WorkShop 6 update 1 C Compiler included the following new and changed features.

    • Support for the UltraSPARC III Processor

      The -xtarget and -xchip flags now accept ultra3.

    • Optimizing Through Type-Based Analysis

      The C compiler now accepts the -xalias_level option and several pragmas which allow it to perform type-based alias analysis and optimizations.

    • Enhancing Math Routine Performance With New Pragmas

      cc -fast now expands to include the macro __MATHERR_ERRNO_DONTCARE. This macro causes math.h on Solaris 8 to assert performance-related pragmas for some of the math routines prototyped in math.h.

    • Using Built-in Standard -Library Functions

      Use the new -xbuiltin command when you want the compiler to improve performance of generated code through substitution of intrinsics, or inlining, of standard library functions as the compiler determines it is profitable.

    • Enabling or Disabling Trigraph Interpretation

      Use the -xtrigraphs command when you want to enable or disable trigraph translation.

    • Prefetch Latency

      Use -xprefetch=latx:n.n to specify a factor to adjust the prefetch-to-load and prefetch-to-store latencies.

    • Overriding the Default Search Path

      The new -I- option gives you more control over the algorithm that the compiler uses when searching for include files.

     

  3. Sun WorkShop 6 New Features

    The Sun WorkShop 6 C compiler included the following new and changed 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 pas s.

    • 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 opti on -errwarn=t, which causes the compiler to exit with a failure st atus 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 t he characters of a multi-character character-constant in the specified byte ord er.

    • -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 ve ctor library functions.




D. Software Corrections

There is no new information at this time. 


E. Problems and Workarounds

This section discusses the following software bugs that could not be fixed in time for this release. For updates, check the Forte Developer Hot Product News link at http://www.sun.com/forte/developer/hotnews.html.


F. Limitations and Incompatibilities

There is no new information at this time.


G. Documentation Errata

There is no new information at this time.


Copyright 2001 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.