Problems building 4.7.4, 4.8.5, 4.9.3, 5.2.0 on HP-UX 11.31/PA

Albert Chin gcc-help@mlists.thewrittenword.com
Fri Dec 4 14:36:00 GMT 2015


I am attempting to build GCC 4.7.4, 4.8.5, 4.9.3, and 5.2.0 on HP-UX
11.31/PA. I have built GCC 4.4.6 successfully on this platform. I am
using GCC 4.4.6 as the bootstrap compiler.

My build procedure for 4.9.3 (4.7.4, 4.8.5, and 5.2.0 are similar):
  $ gtar jxf /opt/src/latest/devel/gcc-4.9.3/src/gcc-4.9.3.tar.bz2
  $ cd gcc-4.9.3
  $ mkdir .obj
  $ cd .obj
  $ PATH=/opt/TWWfsw/gcc44/bin:$PATH ../configure --enable-nls \
--with-included-gettext --enable-shared \
--with-local-prefix=/tmp/gcc48 --with-gmp=/opt/TWWfsw/libgmp51 \
--with-mpfr=/opt/TWWfsw/libmpfr31 \
--with-mpc=/opt/TWWfsw/libmpc10 --with-gnu-as \
--with-as=/opt/TWWfsw/gcc47/hppa2.0-hp-hpux11.31/bin/as \
--prefix=/tmp/gcc48
  ...
  $ PATH=/opt/TWWfsw/gcc44/bin:$PATH gmake
  ...
gcc-4.8.5/.obj/./gcc/xgcc -B/opt/build/china/gcc-4.8.5/.obj/./gcc/ -B/tmp/gcc48/hppa2.0w-hp-hpux11.31/bin/ -B/tmp/gcc48/hppa2.0w-hp-hpux11.31/lib/ -isystem /tmp/gcc48/hppa2.0w-hp-hpux11.31/include -isystem /tmp/gcc48/hppa2.0w-hp-hpux11.31/sys-include -DHAVE_CONFIG_H -I. -I../../../libgfortran -iquote../../../libgfortran/io -I../../../libgfortran/../gcc -I../../../libgfortran/../gcc/config -I../../../libgfortran/../libquadmath -I../.././gcc -I../../../libgfortran/../libgcc -I../libgcc -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -fcx-fortran-rules -g -O2 -MT read.lo -MD -MP -MF .deps/read.Tpo -c ../../../libgfortran/io/read.c  -fPIC -DPIC -o .libs/read.o
../../../libgfortran/io/read.c: In function 'convert_real':
../../../libgfortran/io/read.c:159:30: error: incompatible types when assigning to type 'GFC_REAL_16' from type 'long_double'
       *((GFC_REAL_16*) dest) = gfc_strtold (buffer, &endptr);
                              ^
../../../libgfortran/io/read.c: In function 'read_f':
../../../libgfortran/io/read.c:943:8: warning: array subscript has type 'char' [-Wchar-subscripts]
        if (!isalnum (*out))
        ^
../../../libgfortran/io/read.c:1063:7: warning: array subscript has type 'char' [-Wchar-subscripts]
       while (w > 0 && isdigit (*p))
       ^
../../../libgfortran/io/read.c:1091:4: warning: array subscript has type 'char' [-Wchar-subscripts]
    else if (!isdigit (*p))
    ^
gmake[3]: *** [read.lo] Error 1
gmake[3]: Leaving directory `/opt/build/china/gcc-4.8.5/.obj/hppa2.0w-hp-hpux11.31/libgfortran'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/opt/build/china/gcc-4.8.5/.obj/hppa2.0w-hp-hpux11.31/libgfortran'

All of the above versions of GCC fail to build with the same error
above. On this platform, strtold() is defined as:

#ifdef _INCLUDE_STDC__SOURCE_199901

#  if defined(__ia64)
     /* pragmas needed to support -B protected */ 
#    pragma extern strtold
#  endif /* __ia64 */

#  ifndef _LONG_DOUBLE
#    define _LONG_DOUBLE
#  if !defined(__ia64) || !defined(_PROTOTYPES) ||
defined(_LONG_DOUBLE_STRUCT)
typedef struct {
        uint32_t word1, word2, word3, word4;
        } long_double;
extern long_double strtold __((const char * __restrict, char ** __restrict));
#  else /* !__ia64 || !_PROTOTYPES || _LONG_DOUBLE_STRUCT */
#    ifdef _INCLUDE_HPUX_SOURCE
typedef long double long_double;
#    endif /* _INCLUDE_HPUX_SOURCE */
extern long double strtold __((const char * __restrict, char ** __restrict));
#  endif /* !__ia64 ||!_PROTOTYPES ||_LONG_DOUBLE_STRUCT */
#endif /* _LONG_DOUBLE */

#endif /* _INCLUDE_STDC__SOURCE_199901 */

and long_double is defined as:

# 547 "/opt/build/china/gcc-5.2.0/.obj/gcc/include-fixed/stdlib.h" 3 4
typedef struct {
 uint32_t word1, word2, word3, word4;
 } long_double;

Looks like the long double type, GFC_REAL_16, is defined in
libgfortran/kinds.h which is generated by mk-kinds-h.sh and this
defines "long double" as:
  if $compile -S tmp$$.f90 > /dev/null 2>&1; then
    case $k in
      4) ctype="float" ; cplxtype="complex float" ; suffix="f" ;;
      8) ctype="double" ; cplxtype="complex double" ; suffix="" ;;
      10) ctype="long double" ; cplxtype="complex long double" ; suffix="l" ;;
      16) if [ $long_double_kind -eq 10 ]; then
            ctype="__float128"
            cplxtype="_Complex float __attribute__((mode(TC)))"
            suffix="q"
          else
            ctype="long double"
            cplxtype="complex long double"
            suffix="l"
          fi ;;
      *) echo "$0: Unknown type" >&2 ; exit 1 ;;
    esac

What is the best way to fix this? On HP-UX 11.11/PA and 11.23/PA,
long_double is converted to "long double" by fixincludes/inclhack.def:
/*
 * HP-UX long_double
 */
fix = {
    hackname  = hpux_long_double;
    mach      = "*-*-hpux10*";
    mach      = "*-*-hpux11.[012]*";
    files     = stdlib.h;
    select    = "extern[ \t]long_double[ \t]strtold";
    bypass    = "long_double_t";
    sed       = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
    sed       = "s/long_double/long double/g";

    test_text = "#  ifndef _LONG_DOUBLE\n"
                "#    define _LONG_DOUBLE\n"
                "     typedef struct {\n"
                "       unsigned int word1, word2, word3, word4;\n"
                "     } long_double;\n"
                "#  endif /* _LONG_DOUBLE */\n"
                "extern long_double strtold(const char *, char **);\n";
};

Is there a reason this is not done for HP-UX 11.31?

-- 
albert chin (china@thewrittenword.com)



More information about the Gcc-help mailing list