[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: no quadmath.h on ppc64 ?




>
> Working on it :
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895452
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82686


https://gcc.gnu.org/ml/gcc-testresults/2018-04/msg01351.html


nix$ cat pq.c

#define _XOPEN_SOURCE 600
/* #include <quadmath.h> */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>

#define BUFLEN 128
int    main ( int argc, char*argv[])
{
    int n, precision = FLT128_DIG + 2;
    char buf[BUFLEN];
    char *obuf;
    size_t buf_len = (size_t) BUFLEN;
    __float128 pi_quad = M_PIq;
    __float128 my_pi_quad;

    /* long double pi_ld = 3.1415926535897932384626433832795028841971L;*/
    /* __float128 pi_quad = M_PIq; */

    printf ( "\n 3.1415926535897932384626433832795028841971\n" );

    n = quadmath_snprintf ( buf, buf_len, "%Qg", pi_quad );

    if ( (size_t)n < buf_len ) {
        printf ( "%s\n", buf );
    }

    n = quadmath_snprintf ( NULL, 0, "%+-#46.*Qe", precision, pi_quad );

    if ( n > -1 ) {
        obuf = calloc ( (size_t) (n+1), (size_t)sizeof(unsigned char));
        if ( obuf ) {
n = quadmath_snprintf ( obuf, (n+1), "%+-#46.*Qe", precision, pi_quad );
            printf ( "%s\n", obuf );
            printf ( "also n = %i\n", n );
        } else {
            fprintf ( stderr, "ERROR : well that sucks.\n" );
            return ( EXIT_FAILURE );
        }
        free ( obuf );
    }
    printf ( "\n\n&pi_quad addr %p is :\n", &pi_quad );

my_pi_quad = strtoflt128 ( "3.1415926535897932384626433832795028841971", NULL );
    n = quadmath_snprintf ( NULL, 0, "%+-#46.*Qe", precision, my_pi_quad );
    if ( n > -1 ) {
        obuf = calloc ( (size_t) (n+1), (size_t)sizeof(unsigned char));
        if ( obuf ) {
n = quadmath_snprintf ( obuf, (n+1), "%+-#46.*Qe", precision, my_pi_quad );
            printf ( "%s\n", obuf );
            printf ( "also n = %i\n", n );
        } else {
            fprintf ( stderr, "ERROR : well that really sucks.\n" );
            return ( EXIT_FAILURE );
        }
        free ( obuf );
    }

    printf ( "\n\n&my_pi_quad addr %p is :\n", &my_pi_quad );

    return ( EXIT_SUCCESS );

}

nix$ grep "FLT128_DIG" /usr/local/gcc7/lib/gcc/powerpc64-unknown-linux-gnu/7.3.0/include/float.h
#undef FLT128_DIG
#define FLT128_DIG              __FLT128_DIG__
nix$

nix$ /usr/local/gcc7/bin/gcc -v -m64 -g -S -o pq.s pq.c
Using built-in specs.
COLLECT_GCC=/usr/local/gcc7/bin/gcc
Target: powerpc64-unknown-linux-gnu
Configured with: ../gcc-7.3.0/configure --build=powerpc64-unknown-linux-gnu --target=powerpc64-unknown-linux-gnu --host=powerpc64-unknown-linux-gnu --prefix=/usr/local/gcc7 --disable-nls --enable-threads=posix --enable-shared --enable-bootstrap --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-__cxa_atexit --with-system-zlib --disable-objc-gc --with-long-double-128 --enable-stage1-languages=c,c++ --enable-stage1-checking=misc --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --with-pkgversion='genunix Mon Apr 16 00:04:56 GMT 2018'
Thread model: posix
gcc version 7.3.0 (genunix Mon Apr 16 00:04:56 GMT 2018)
COLLECT_GCC_OPTIONS='-v' '-m64' '-g' '-S' '-o' 'pq.s'
/usr/local/gcc7/libexec/gcc/powerpc64-unknown-linux-gnu/7.3.0/cc1 -quiet -v -imultiarch powerpc64-linux-gnu -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix pq.c -quiet -dumpbase pq.c -m64 -auxbase-strip pq.s -g -version -o pq.s GNU C11 (genunix Mon Apr 16 00:04:56 GMT 2018) version 7.3.0 (powerpc64-unknown-linux-gnu) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/powerpc64-linux-gnu"
ignoring nonexistent directory "/usr/local/gcc7/lib/gcc/powerpc64-unknown-linux-gnu/7.3.0/../../../../powerpc64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc7/lib/gcc/powerpc64-unknown-linux-gnu/7.3.0/include
 /usr/local/include
 /usr/local/gcc7/include
 /usr/local/gcc7/lib/gcc/powerpc64-unknown-linux-gnu/7.3.0/include-fixed
 /usr/include/powerpc64-linux-gnu
 /usr/include
End of search list.
GNU C11 (genunix Mon Apr 16 00:04:56 GMT 2018) version 7.3.0 (powerpc64-unknown-linux-gnu) compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4128dcdbf8336d61e21fa946bc1dc074
pq.c: In function 'main':
pq.c:13:24: error: 'FLT128_DIG' undeclared (first use in this function); did you mean 'FLT_DIG'?
     int n, precision = FLT128_DIG + 2;
                        ^~~~~~~~~~
                        FLT_DIG
pq.c:13:24: note: each undeclared identifier is reported only once for each function it appears in
pq.c:17:5: error: unknown type name '__float128'; did you mean '_Float128'?
     __float128 pi_quad = M_PIq;
     ^~~~~~~~~~
     _Float128
pq.c:17:26: error: 'M_PIq' undeclared (first use in this function); did you mean 'M_PI'?
     __float128 pi_quad = M_PIq;
                          ^~~~~
                          M_PI
pq.c:18:5: error: unknown type name '__float128'; did you mean '_Float128'?
     __float128 my_pi_quad;
     ^~~~~~~~~~
     _Float128
pq.c:25:9: warning: implicit declaration of function 'quadmath_snprintf'; did you mean '__builtin_snprintf'? [-Wimplicit-function-declaration]
     n = quadmath_snprintf ( buf, buf_len, "%Qg", pi_quad );
         ^~~~~~~~~~~~~~~~~
         __builtin_snprintf
pq.c:47:18: warning: implicit declaration of function 'strtoflt128'; did you mean 'strtoull'? [-Wimplicit-function-declaration] my_pi_quad = strtoflt128 ( "3.1415926535897932384626433832795028841971", NULL );
                  ^~~~~~~~~~~
                  strtoull
nix$


 Dennis


Reply to: