Patch-ID# 112760-13
Keywords: c 5.5 security
Synopsis: C 5.5: Patch for S1S8CC C compiler
Date: Aug/19/2004


Install Requirements: None                      
                      
Solaris Release: 7 8 9

SunOS Release: 5.7 5.8 5.9

Unbundled Product: Sun ONE Studio 8 Compiler Common C

Unbundled Release: 5.5

Xref: 

Topic: 

Relevant Architectures: sparc

BugId's fixed with this patch: 1253033 4309958 4395077 4408927 4708828 4774706 4806149 4808597 4809489 4810947 4815236 4821024 4821786 4822247 4824557 4824750 4826795 4826993 4829392 4830854 4832526 4833180 4834261 4834785 4835844 4836247 4839296 4842571 4842575 4842678 4842685 4845935 4846094 4846908 4847580 4848777 4849411 4854646 4856679 4860689 4866244 4875766 4876867 4877995 4879683 4898183 4900673 4902471 4907885 4923441 4974440 4982821 4984102 4984367 4993288 5010364 5015854 5049814 5054633 5067752

Changes incorporated in this version: 5067752

Patches accumulated and obsoleted by this patch: 

Patches which conflict with this patch: 

Patches required with this patch: 

Obsoleted by: 

Files included with this patch: 

<install_dir>/SUNWspro/prod/bin/acomp
<install_dir>/SUNWspro/prod/bin/c89
<install_dir>/SUNWspro/prod/bin/c99
<install_dir>/SUNWspro/prod/bin/cc
<install_dir>/SUNWspro/prod/bin/lint
<install_dir>/SUNWspro/prod/bin/lint1
<install_dir>/SUNWspro/prod/bin/lint2
<install_dir>/SUNWspro/prod/bin/lint2n
<install_dir>/SUNWspro/prod/bin/ssbd
<install_dir>/SUNWspro/prod/lib/locale/C/LC_MESSAGES/SUNW_SPRO_SC_acomp.error_help.html
<install_dir>/SUNWspro/prod/lib/locale/C/LC_MESSAGES/SUNW_SPRO_SC_acomp.msg

Problem Description:

5067752 cg fails w/ "assertion failed in file ../src/codegen/map_pseudo.cc at line 8589"
 
(from 112760-12)
4982821 parameter passing problem in V9 code
4984102 v9 float struct parameter received in wrong place
4993288 S1S8: Internal error compiling a PNP CAD tool at no optimization
 
(from 112760-11)
5054633 escaped numerics in string literals w/ -xustr=ascii_utf16_ushort fail to compile
 
(from 112760-10)
 
5049814 SS8 lint crashes with a PTC source file
 
(from 112760-09)
 
5010364 compiler components should not use libc private interfaces
5015854 MATLAB routine crashes S1S8 compiler
 
(from 112760-08)
 
4984367 problems with 64-bit compilation using F6U2 as well S1S8 with "c" compiler
 
(from 112760-07)
 
4974440 C 5.4 and C 5.5 compilers with -S option seem to generate bad assembly code
 
(from 112760-06)
 
4830854 _Pragma causes internal compiler error: non-null curtoken in lx_s_sharp()
 
(from 112760-05)
 
4902471 fpclassify can trash the stack
4907885 bug in cc when -g or -O are not used
 
(from 112760-04)
 
4866244 k2 (fcs) generates different code on reruns in some case (nothing else changed)
4923441 lint complains about some constant format strings
 
 
(from 112760-03)
 
4898183 lint security checks should treat other gettext() variants like gettext()
 
(from 112760-02)
 
4860689 QS: fatal runtime error with -xprofile=collect -mt after dlclose()
4875766 mercury x-86 & sparc C compiler gives error on simple C file
4876867 mercury acomp fails on 403.gcc benchmark
4877995 Add checking for insecure coding practices to lint
4879683 mozilla-1.3a; Segmentation Fault with "-KPIC -xarch=v9"
4900673 ir_type of addr-const leaf of array is incorrect: "pointer pointer array"
 
(from 112760-01)
 
4856679 REGRESSION: duplicated .a and .o files are no longer being passed to ld
4854646 QS: Add option -xldscoperef
4846094 -xsfpconst does not function properly from K2 onwards
4842571 wrong value for imaginary to bool conversion
4848777 K2: After build a lot of 0-size temporary files were left in /tmp
4833180 cg failed: CODEGEN IR TREE SYNTAX in return (f(v1,v2)?v1:v2); v1 & v2 in diff _Imaginary types
4810947 needs support for predefined macro __STDC_HOSTED__.
4845935 C driver does not pass -D_REENTRANT when passed -xopenmp
4809489 bitfield 0 for unnamed members should be allowed in struct/union
4309958 lint: Segmentation fault with -Nlevel=3
4408927 lint -Nlevel=4 dumps core
4395077 static detection of unset variables doesn't work
4836247 acomp hangs with a bad input.
4826795 __tgmath_nexttoward broken for float and double first argument
1253033 c compiler -c -o option will not allow for anything but extension of .o
4842575 cc -xipo -xhwcprof -xdebugformat=dwarf creates bad relocations in dwarf symbols
4806149 Too slow compilation with '-fast' switch
4824557 PCH: #error directive is not allowed in viable prefix
4821024 C Precompiled headers performance problem
4822247 warning: PCH file unusable, -D or -U options must match used when creating pch
4821786 PCH: incorrect viable prefix when declaration used in main source
4708828 Data needing relocation goest to .rodata instead of .picdata
4832526 bad IR header with -xhwcprof {-xparallel,-xautopar,-xexplicitpar,-xopenmp}
4829392 tls + data fragmentation + optimization is not yet supported in K2 for c
4774706 Static variables defined in precompiled headers can't be displayed in dbx
4826993 simple c program segfaults with SunONE 8 compiler
4824750 (_Bool)(37 * _Imaginary_I) should yield 1 instead of 0.
4846908 expression !(double) is evaluated incorrectly
4808597 mlib_ImageAffineIndex (v8plusa) test coredump under k2
4815236 empty function generates 13 or 17 instructions; should be 2
4834261 c99: I-=(Complex == -Complex) gives incorout
4834785 c99: 1/long_double_Complex causes acomp assert failed in xlate.c w -xarch=v9
4835844 Data fragmentation: .section ".picdata%name" is empty with -KPIC
4839296 test fails when compiled without optimization
4842678 wrong value for conversion of double to bool
4842685 wrong value for complex to bool conversion
4847580 C99 "quiet" comparison macro produces noisy fp compare instruction
4849411 h263 codec test failure under compiler later than zephyr

Patch Installation Instructions:
--------------------------------
For Solaris 7-9 releases, refer to the man pages for instructions on
using 'patchadd' and 'patchrm' scripts provided with Solaris.
Any other special or non-generic installation instructions should be
described below as special instructions.  The following example
installs a patch to a standalone machine:
 
        example# patchadd /var/spool/patch/106326-01
 
The following example removes a patch from a standalone system:
 
        example# patchrm 104945-02
 
For additional examples please see the appropriate man pages.

Special Install Instructions:
-----------------------------
 
If you are compiling or linking programs or shared libraries
using -xprofile=collect, it is strongly recommended that you also
install the most recent version of the following patches for the
corresponding compiler products shown below:
 
        product     patch
        -------     -----
        C++ 5.5     113817-02 or later
        F95 7.1     112762-03 or later
 
Patch 112763-03 or later provides a new object file "prof_tsd.o" which
exports global routines required at runtime for correct execution
of MT applications that dynamically link with shared libraries
that have been compiled and linked with -xprofile=collect.
In order to pass "prof_tsd.o" to the linker when a program
is linked with -xprofile=collect, changes to the cc, CC, and
f95 drivers are required.  These driver changes are provided
in the above patches to the C, C++, and F95 products.
 
To test whether you have installed the patches correctly, use the
following test case, which consists of a C++ source file "main.cc",
two C source files "test.c" and "shared.c", and a shell script "try.sh"
which compiles and links "main.cc" and test.c" into a profiled program
"main", and also compiles and links "shared.c" into a profiled shared
library "shared.so":
 
    % cat main.cc
 
    extern "C" test_();
 
    int
    main()
    {
        test_();
        return 0;
    }
 
    % cat test.c
 
    #include <thread.h>
    #include <dlfcn.h>
    #include <link.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <errno.h>
    static void
    dlerror_message(const char *fn)
    {
        const char *msg = dlerror();
        fprintf(stderr, "%s() failed", fn);
        if (msg != NULL)
        {
            fprintf(stderr, ": %s", msg);
        }
        fprintf(stderr, "\n");
    }
    void *
    foo(void* cookie)
    {
        void *hndl = dlopen("./shared.so", RTLD_NOW);
        if (hndl == NULL)
        {
            dlerror_message("dlopen");
        }
        else /* hndl != NULL */
        {
            void *f = dlsym(hndl, "function_f");
            if (f == NULL)
            {
                dlerror_message("dlsym");
            }
            else
            {
                ((void(*)(void))f)();
            }
            dlclose(hndl);
        }
        return NULL;
    }
    int test_()
    {
        thread_t tid;
        thr_create(NULL, 0, foo, NULL, THR_BOUND|THR_NEW_LWP, &tid);
        thr_join(tid, NULL, NULL);
        printf("end of test\n");
        return 0;
    }
 
    % cat shared.c
 
    #include <stdio.h>
    void
    function_f(void)
    {
        printf("Here's function f\n");
    }
 
To compile and execute the installation test case, use
the following shell script:
 
    % cat try.sh
    #!/bin/sh
    set -x
    cc -O -mt -xprofile=collect -KPIC shared.c -G -o shared.so \
    && cc -O -mt -xprofile=collect test.c -c \
    && CC -O -mt -xprofile=collect main.cc test.o -o main \
    && rm -rf main.profile \
    && ./main \
    && ls main.profile
 
There are four (4) installation cases to consider.
 
Case 0 (no patches installed):
------------------------------
 
If neither patch 112763-03 or later (Common Compiler S1S8CC) nor
patch 113817-02 or later (C++ 5.5) has been installed correctly,
both the program "main" and the shared library "shared.so" will
compile and link without errors, but the process will abort at
runtime with a Segmentation Fault:
 
    % sh try.sh
    + cc -O -mt -xprofile=collect -KPIC shared.c -G -o shared.so 
    + cc -O -mt -xprofile=collect test.c -c 
    + CC -O -mt -xprofile=collect main.cc test.o -o main 
    + rm -rf main.profile 
    + ./main 
    Segmentation Fault - core dumped
 
Case 1 (missing C++ 5.5 patch):
-----------------------------
 
If patch 112763-03 or later (Common Compiler S1S8CC) has been installed
correctly, but patch 113817-02 or later (C++ 5.5) has not, both
the program "main" and the shared library "shared.so" will
compile and link without errors, but the shared library
"shared.so" will print a warning message at runtime and will
run with MT profile collection disabled.
 
    % sh try.sh
    + cc -O -mt -xprofile=collect -KPIC shared.c -G -o shared.so 
    + cc -O -mt -xprofile=collect test.c -c 
    + CC -O -mt -xprofile=collect main.cc test.o -o main 
    + rm -rf main.profile 
    + ./main 
    profile feedback: dlsym() could not find function __new_profile_thread_list_ops()
    warning: MT profile collection disabled for object file
"/home/joe/bugs/4860689/tmp/shared.o"
    Here's function f
    end of test
    + ls main.profile
    feedbin         feedbin.lock
 
Note that in this case, despite the runtime warning message, the
feedback file main.profile/feedbin was generated.   In an actual MT
application, some of the profile data in the feedback file may be
inaccurate, due to concurrent attempts to update profile counters
by multiple threads.  If multiple threads simultaneously attempt to
close the same profiled shared library by calling dlclose(3DL), the
contents of the feedback file may be corrupted or lost.
 
Case 2 (missing Common Compiler S1S8CC patch):
----------------------------------------------
 
If patch 113817-02 or later (C++ 5.5) has been installed correctly
but patch 112763-04 or later (Common Compiler S1S8CC) has not, the program
"main" will fail to link correctly.  A message from the driver (CC)
will indicate that the required object file "prof_tsd.o" is missing:
 
    % sh try.sh
    + cc -O -mt -xprofile=collect -KPIC shared.c -G -o shared.so 
    + cc -O -mt -xprofile=collect test.c -c 
    + CC -O -mt -xprofile=collect main.cc test.o -o main 
    CC: Cannot find /opt/SUNWspro/prod/lib/prof_tsd.o
 
Case 3 (both C++ 5.5 and Common Compiler S1S8CC patch installed correctly):
---------------------------------------------------------------------------
 
If patch 112763-04 or later (Common Compiler S1S8CC) and patch 113817-02
or later (C++ 5.5) have both been installed correctly, both the
program "main" and the shared library "shared.so" will compile,
link, and execute correctly, producing a profile feedback file
"main.profile/feedbin":
 
    % sh try.sh
    + cc -O -mt -xprofile=collect -KPIC shared.c -G -o shared.so 
    + cc -O -mt -xprofile=collect test.c -c 
    + CC -O -mt -xprofile=collect main.cc test.o -o main 
    + rm -rf main.profile 
    + ./main 
    Here's function f
    end of test
    + ls main.profile
    feedbin         feedbin.lock

README -- Last modified date:  Thursday, August 19, 2004

