Patch-ID# 112763-19

NOTE:
***********************************************************************
READ THE TERMS OF THE AGREEMENT ("AGREEMENT") IN THE LEGAL_LICENSE.TXT
FILE CAREFULLY BEFORE USING THIS SOFTWARE. BY USING THE SOFTWARE, YOU
AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE
TERMS, PROMPTLY DESTROY THE UNUSED SOFTWARE.
***********************************************************************

Keywords: common compiler backend iropt cg libmtsk s1s8cc
Synopsis: Compiler Common S1S8CC: Patch for S1S8CC C C++ F77 F95
Date: Nov/03/2005


Install Requirements: NA                      
                      
Solaris Release: 7 8 9 10

SunOS Release: 5.7 5.8 5.9 5.10

Unbundled Product: Sun ONE Studio 8 Compiler Common

Unbundled Release: 8.0

Xref: 

Topic: 

Relevant Architectures: sparc

BugId's fixed with this patch: 4464945 4678098 4806135 4808597 4809716 4811985 4817961 4818269 4818535 4818984 4819687 4819934 4822859 4824026 4824691 4825280 4826775 4828141 4828737 4829150 4829152 4830166 4830889 4832255 4833771 4834939 4837289 4837521 4838034 4838886 4839175 4840054 4840154 4841096 4841608 4841807 4841837 4842034 4843515 4843560 4848192 4849480 4850588 4851056 4852175 4853862 4854109 4854407 4854915 4856302 4857622 4857633 4858364 4858757 4860689 4860779 4864152 4866237 4868558 4869118 4869187 4870004 4870754 4871589 4873408 4878211 4881017 4881820 4882033 4882316 4883008 4884057 4884984 4888677 4897924 4909681 4912809 4917251 4918119 4919539 4926164 4930423 4931585 4938033 4939462 4947720 4948722 4957264 4958275 4958920 4960033 4960593 4961853 4963569 4964436 4964636 4965101 4970415 4971414 4975247 4975328 4976470 4978600 4981147 4981495 4982348 4982381 4984085 4984140 4985334 4988568 4989787 4990108 4994303 4994664 5004829 5008035 5010931 5022514 5026128 5033033 5042131 5042228 5047388 5056670 5066123 5068534 5069765 5070405 5074738 5077425 5077763 5080786 5082566 5086140 5100182 5104604 5106761 6175310 6181969 6188725 6199533 6203705 6211038 6239305 6254211 6268223 6294461 6301427 6302645 6312534 6325177 6327496 6328734

Changes incorporated in this version: 6325177 6327496 6328734

Patches accumulated and obsoleted by this patch: 

Patches which conflict with this patch: 

Patches required with this patch: 
NOTE:    See Special Install Instructions below.

Obsoleted by: 

Files included with this patch: 

<install_dir>/SUNWspro/prod/bin/cg
<install_dir>/SUNWspro/prod/bin/fbe
<install_dir>/SUNWspro/prod/bin/iropt
<install_dir>/SUNWspro/prod/bin/postopt
<install_dir>/SUNWspro/prod/include/cc/sys/vis_types.h
<install_dir>/SUNWspro/prod/lib/cg/model_cg_super.so.3
<install_dir>/SUNWspro/prod/lib/cg/model_cg_super2.so.3
<install_dir>/SUNWspro/prod/lib/cg/model_cg_ultra.so.3
<install_dir>/SUNWspro/prod/lib/cg/model_cg_ultra3.so.3
<install_dir>/SUNWspro/prod/lib/libfast.a
<install_dir>/SUNWspro/prod/lib/libmtsk.a
<install_dir>/SUNWspro/prod/lib/libompstubs.a
<install_dir>/SUNWspro/prod/lib/libp/libfast.a
<install_dir>/SUNWspro/prod/lib/prof_lib.o
<install_dir>/SUNWspro/prod/lib/prof_tsd.o
<install_dir>/SUNWspro/prod/lib/v9/libmtsk.a
<install_dir>/SUNWspro/prod/lib/v9/libompstubs.a
<install_dir>/SUNWspro/prod/lib/v9/prof_lib.o
<install_dir>/SUNWspro/prod/lib/v9/prof_tsd.o

Problem Description:

6325177 Incorrect code generated for bitfield extraction with -xO3 optimization and -xarch=v9 
6327496 C 5.5: -fast (-xalias_level) leads to incorrect result at runtime 
6328734 cc 5.5, 5.6, 5.7: iropt hangs if a constant is set to a large value. 
 
(from 112763-18)
6239305 -xvector related iropt Qoption needed 
6254211 postopt core dump while building SAP .so 
6268223 PostOptimizer removes symbol visibility flag from intermediate files 
6294461 TLS relocation errors if -O is used 
6301427 bug in TLS code generation 
6302645 C 5.5 variable bug 
6312534 u3 v8plus SPEC2000 179.art showed about -50% regression with 20050810_k2_patch on fibula
 
(from 112763-17)
5080786 a.out generated via .s (.f->.s->a.out) fails. 
6181969 C:coredump(seg-fault) w/ 20041014_k2_patch_seongbae w/ -xO3. All of k2 patches failed. 
6188725 C++ 5.5/5.6 CODEGEN IR TREE SYNTAX ERROR on correct code. 
6199533 SPECOMP thread 23 324.apsi_m miscompare with 20041117_k2_patch 
6203705 Compiler crash in codegen (IR TREE SYNTAX ERROR) 
6211038 postopt fails while compiling 186.crafty peak 
 
(from 112763-16)
5042131 Needed postopt support for TLS
5047388 libfast.a only allocates half of blocksize as returned by getrlimit() at max
5082566 SEGV at runtime when trying to write to an array allocated by libfast.a
5086140 Combination of -xO4 and -xdepend causes codegen syntax error
5100182 f90 7.1: Dependency checking generates silent data corruption.
5104604 cg assertion failure on oracle with 20040913_venus
5106761 vectorization produces incorrect results in 64-bit app
6175310 20041002_venus iropt dumps core compiling 099.go with -xO4 -xprofile=use
 
(from 112763-15)
5068534 Assmebler factoring out expressions wrongly
5069765 f90 -xdepend generates incorrect code
5070405 assertion "cg: binary_fmt: shouldn't be a V9 instruction"
5074738 The perforamnce in C compiler is slow
5077425 postopt link error with -xF needs fixes in k2, mercury, and venus
5077763 ir tree syntax error
 
(from 112763-14)
5022514 Incorrect code for v9 uint return
5026128 incorout -xipo=2 -xdepend; 1stF:20040304_mercury
5033033 vectorization produces wrong results
5042228 f90 assertion error in ../src/sblock.c (Fatal error in iropt)
5056670 SR fails when too many variables involved
5066123 Assertion failure in Studio 8 (K2) compiler
 
(from 112763-13)
4984085 Incorrect parallelization message generated
4989787 failure in c/constarith/llmul
5008035 Rainier iropt consumes too much memory compiling a CADDS5 C++ file
5010931 S1S8 pathological behaviour of -fast
 
(from 112763-12)
4970415 Segmentation Fault with  -xO3 or higher
4988568 f95: cg segfault if using "-xmaxopt=5" and "-g" compilation flags.
4994303 cg crashes on inconsistent feedback information
4994664 invalid triple alignment
5004829 Rainier iropt segv compiling CADDS5 fortran code
 
(from 112763-11)
4975328 SOS8 cc with -xO4 and -xO3 makes ruby to coredump and fail to build package
4981147 CATIA gives wrong results if compiled with "-xO2"
4982348 incorout -xO3 _Bool type; 1stF:20040105_mercury
4982381 OpenMP: Copyprivate fails using nozomi/krakatoa compiler and mercury runtime
4984140 openmp: alloca small private variables in K2 (s1s8cc_patch)
4985334 112763-08: iropt is spinning in get_overlap_leaf() consuming one cpu
4990108 S1S8 f90 regression -fsimple=2 with -O3 gives silent data corruption
 
(from 112763-10)
4971414 max value for OMP_NUM_THREADS needs to be increased
4978600 optimizer bug (structure return tail-call)
4981495 Linking 10g code w/wo -xO3, with shared obj. (-xO3) on K2 gives different o/p
 
(from 112763-09)
4964436 vis_ras type missing from vis_types.h
4975247 cg asssert instruction.cc w -xarch=v8plus -xO4 -xrestrict -xdepend; Nozomi_patch
4976470 Compiling Oracle 10g with K2 using -xO3 gives seg. fault
 
(from 112763-08)
4948722 QS: ANSYS Fortran code sets variables in loop incorrectly with -O3
4957264 templated function is marked UNDEF in symbol table when compiled optimized
4961853 RT segfault -xcheck=stkovf -xautopar -xspace -xmemalign -xO4 -xarch=v9a
4963569 K2: CATIA SEGV when handling exceptions if we compile using O2, compat=4, and KP
4964636 long long cast to float produces different results based on optimization level
4965101 K2: stream core dump for copy with large arrays
 
(from 112763-07)
4806135 incorout w -xprofile=use -xautopar -xreduction -xbuiltin -xlibmil -xO5 -xarch=v9
4931585 For code with huge switch statement, inreased iropt size with 113817-01
4947720 some routines which address things on the stack compile poorly in v9
4958275 Solaris CBE patch needed for "volatile" problem that is fixed in Mercury
4958920 S1S8 iropt SEGVs processing customer's code
4960033 combining -xF and -xlinkopt causes postopt to "optimize" forever
4960593 cg: assertion failed in file ../src/translator/sunIR.cc; 1stF:20031124_mercury
 
(from 112763-06)
4871589 -xprofile=collect without -mt produces bogus runtime warning message on S10
4882033 QS: manual prefetch not working with C++
4918119 CPU2004 gamess gets wrong answer with feedback and -xipo=2
4919539 f90 7.1: iropt runs out of memory when compiling Gaussian with -xprefetch=auto
4926164 program compiled w/ -xprofile=collect fails assertion when resetting profile
4930423 Compiling Oracle 10iR1 with K2 using -xlinkopt gives assertion error
4938033 memory allocation error with s1s8cc CC compiler.
4939462 cg: assertion failed in file ../src/assembler/cg_relocs.cc at line 971
 
(from 112763-05)
4868558 spec2000 test facerec fails w/ segmentation dault
4870754 fxtod v9 instruction very slow on US3, need to switch to v8 instructions
4882316 QS: OB-4.1.0: 'ipo' fatal error with '-xO4 -xipo'
4897924 F95 forall test fails at -xO3 since 0522_mercury
4909681 Assertion failure for exceeding limit on branch condition
4912809 openmp: inner parallel region with serialized outer region should go parallel
4917251 f95 7.1 iropt segmentation fault with -O3 when compiling Gaussian
 
(from 112763-04)
4860689 QS: fatal runtime error with -xprofile=collect -mt after dlclose()
4884057 cg assertion during 450.soplex compilation
 
(from 112763-03)
4809716 C compiler generates incorrect codes for libc
4866237 CC incorout w -xO4 -xprofile=use -xunroll=1 -xarch=v8plusa... since k2
4869118 Compiler bug causes broken store-ordering, leading to system panic
4869187 -xopenmp=noopt uses excessive memory
4878211 cgen: -O4 cause the bad code to be generated in sba runtime library.
4881017 grd2b excessive compile time
4881820 Conflict between symbol VIS and __VIS
4883008 QS: ANSYS Fortran routine segv with Q option
4884984 QS: ANSYS Fortran routine S1S8 -O3 causes SEGV
4888677 Sybase IQ gets iropt into an infinite loop
 
(from 112763-02)
4811985 f90 compiler source file compiled with -xO2 produces incorrect results
4838034 FD7 Fortran app built with -stackvar crashes with SIGBUS
4841608 mlib_ImageSobel_S16 (v8plusb) test failure under latest mercury
4853862 cg (k2, mercury) issued assertion while compiled source code with -S option
4858364 K2_FCS cg generates wrong code in a window zoom routine
4858757 postopt fails during the generation of fbo (feedbackoptimized) binary
4860779 iropt failure
4864152 K2_FCS generates wrong code in a contour routine
4870004 ls-dyna: coredump in cg
4873408 K2_FCS generates wrong code in group.o
 
(from 112763-01)
4464945 bad conversion of 0LL to float with fp_round=FP_RM
4678098 pragma weak doesn't function as expected.
4808597 mlib_ImageAffineIndex (v8plusa) test coredump under k2
4817961 VFE: With v9-O4, failure in call to functio from vfe
4818269 cg internal error
4818535 no debug info in memops for references to structure members of array type
4818984 iropt generates redundant IR profile feedback edges
4819687 F90: cray pointers as actual args are problems
4819934 iropt warning is printed too many times
4822859 Codegen Error with anything higher than -xO2
4824026 segv when -z combreloc is used with -xlinkopt
4824691 _Bool a=196608+0*I -> 1 with yabe; 0 with cg
4825280 ac3 decoder (v8plusa) test failure under k2 and krakatoa
4826775 c99 ordered comparison macros broken when NaN is involved
4828141 cg assert fail in recgen.cc: recgen.do_inline_move: bad addressing mode
4828737 incorout long_double_Imaginary - float_Complex
4829150 -xparallel causes CODEGEN IR TREE SYNTAX ERROR at line (4622060.c:417)
4829152 segv while building openssl with -xhwcprof=enable -xdebugformat=dwarf
4830166 OMP-CC: vector is corrupted when doing firstprivate of vector class object
4830889 TLS: testcase coredumps with -xarch=v9 and -g
4832255 cg error: tmpleaf->regman_refs is less than what it should be
4833771 cg asserted failed in ms_pipe/sp_interface.cc at line 5670; VLA _Bool type
4834939 c99: bool = -long_double_Complex gives incorout
4837289 mgrid base compiler time core dump with "-Atile:skewp"
4837521 six symbols missing from VIS header in mercury and k2
4838886 QS: Loops in middle of large subroutine not optimized well
4839175 bzip2 base miscompare with -Atile:skewp
4840054 OMP-CC: testcase crashes on calling virtual function
4840154 skewed tiling (-W2,-Atile:skewp) causes miscompare with 20030329_0328fe_k2_patch
4841096 iropt creates dangling cross-module IR type references with -xipo -xhwcprof -g
4841807 K2 inappropriate loop fusion on equivalenced array
4841837 postopt asserts on undefined local symbols
4842034 Incorrect line number info generated
4843515 globalized static function under -xipo breaks -xdebugformat=dwarf
4843560 skewed tiling core dump in iropt with 20030329_0328fe_k2_patch
4848192 blitz-0.6: 28% compile-time regression in mercury vs k2-fcs
4849480 vortex mem10.c fails xalias std
4850588 f90: Wrong result for -xO4
4851056 -W2,-Atile:skewp causes iropt Bus error
4852175 QS: K2_FCS generates wrong code in a Pro/E ui routine
4854109 OMP-F: iropt bus error in insert_list when using write statement in single
4854407 no memop type information in k2_patch at -xO2 and above
4854915 OMP-C: pthreads and OpenMP not playing nice together
4856302 iropt: incorrect opt around weak symbols
4857622 QS: Internal compiler error
4857633 OMP-F: iropt error:  connect_labelrefs: undefined label - using -C

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	    112760-02 or later
	C++ 5.5	    113817-02 or later
	F95 7.1	    112762-03 or later
 
Patch 112763-04 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 two C source files "main.c"
and "shared.c", and a shell script "try.sh" which compiles and
links "main.c" and "shared.c" into a profiled program "main" and
a profiled shared library "shared.so", respectively:
 
    % cat main.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 main()
    {
	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 -x
    cc -O -mt -xprofile=collect -KPIC shared.c -G -o shared.so \
    && cc -O -mt -xprofile=collect main.c -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-04 or later (Common Compiler S1S8CC) nor
patch 112760-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 main.c -o main
    + rm -rf main.profile
    + ./main
    Segmentation Fault - core dumped
 
Case 1 (missing C 5.5 patch):
-----------------------------
 
If patch 112763-04 or later (Common Compiler S1S8CC) has been installed
correctly, but patch 112760-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 main.c -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 112760-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 linker (ld)
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 main.c -o main
    ld: fatal: file /opt/SUNWspro/prod/lib/prof_tsd.o: open failed: No such file or directory
 
Case 3 (both C 5.5 and Common Compiler S1S8CC patch installed correctly):
-------------------------------------------------------------------------
 
If patch 112763-04 or later (Common Compiler S1S8CC) and patch 112760-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 main.c -o main
    + rm -rf main.profile
    + ./main
    Here's function f
    end of test
    + ls main.profile
    feedbin         feedbin.lock

README -- Last modified date:  Friday, March 10, 2006

