18 March 2008 This is an approved src.alt for 400.perlbench in CPU2006 v1.0 and v1.0.1. It fixes a problem building the benchmark in 32-bit mode with GCC or GCCfss on newer versions of Solaris. To apply the src.alt, unpack the tar file in the top level of the CPU2006 directory. The following sequence of commands should accomplish this: $ /bin/sh $ cd $ . ./shrc $ go top $ specbzip2 -dc | spectar -xvf - Please replace the items in angle brackets ( <> ) as appropriate. To have the src.alt applied during compilation, please add the following stanza to your config file: # Remove direct access FILE struct members 400.perlbench: srcalt=solaris_gcc This change removes some access to members of the FILE structure. The code change mirrors what was done in Perl 5.10.0, and causes the code presented to the compiler to be effectively the same as what is seen by the Sun Studio compilers. Please address any questions about this src.alt to cpu2006support@spec.org. DETAILS OF CHANGE: A change was made to the Solaris FILE structure in order to support more than 256 stdio file descriptors in 32-bit mode. 400.perlbench attempted to access members of this structure directly, and the renaming of one of the members causes the compilation to fail. The code that performs this access was only enabled if the C preprocessor symbol __sun__ was defined. The Sun Studio compilers do not define this symbol by default; GCC does. This change is necessary when building 400.perlbench using GCC (or GCC- compatibile) compilers on newer versions of Solaris. While it is not necessary when building with Sun Studio compilers, it is also not harmful. The code change follows. The diff is quite large, but the change is easy to describe. All of the code in the PerlIOStdio_invalidate_fileno() function in perlio.c which was protected by __sun__ is replaced by the following line: return 0; This makes this section of the code consistent with the code as it stands in the standard distribution of Perl 5.10.0, and the behavior identical to the behavior when compiled with Sun Studio. --- ../perlio.c Mon Jun 6 20:30:23 2005 +++ solaris_gcc/perlio.c Wed Mar 12 12:48:01 2008 @@ -2847,31 +2847,7 @@ f->_fileno = -1; return 1; # elif defined(__sun__) -# if defined(_LP64) - /* On solaris, if _LP64 is defined, the FILE structure is this: - * - * struct FILE { - * long __pad[16]; - * }; - * - * It turns out that the fd is stored in the top 32 bits of - * file->__pad[4]. The lower 32 bits contain flags. file->pad[5] appears - * to contain a pointer or offset into another structure. All the - * remaining fields are zero. - * - * We set the top bits to -1 (0xFFFFFFFF). - */ - f->__pad[4] |= 0xffffffff00000000L; - assert(fileno(f) == 0xffffffff); -# else /* !defined(_LP64) */ - /* _file is just a unsigned char :-( - Not clear why we dup() rather than using -1 - even if that would be treated as 0xFF - so will - a dup fail ... - */ - f->_file = PerlLIO_dup(fileno(f)); -# endif /* defined(_LP64) */ - return 1; + return 0; # elif defined(__hpux) f->__fileH = 0xff; f->__fileL = 0xff;