This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/567: gdb 5.2 on sparc64 cannot print value of double variable


>Number:         567
>Category:       gdb
>Synopsis:       gdb 5.2 on sparc64 cannot print value of double variable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 11 13:48:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     john@fea.com
>Release:        gdb-5.2
>Organization:
>Environment:
sparc64-sun-solaris2.8
>Description:
The sparc64-sun-solaris2.8 GDB 5.2 seemingly cannot correctly display
the value of a floating-point variable in C.

This program illustrates the problem.

#include <stdio.h>

    int
    main()
    {
        double d1;

        d1 = 3.3;
        printf("d1 = %f\n", d1);

        return 0;
    }

The program was compiled with GCC 3.1 using -m64.

This is the program output:

    d1 = 3.300000

If you break on the printf line, you get the following from GDB.

For the program compiled with GCC 3.1 using -m64:

    Breakpoint 1, main () at double.c:9
    9               printf("d1 = %f\n", d1);
    (gdb) p d1
    $1 = 1.8626433728741176e-10
    (gdb) x/xg &d1
    0xffffffff7ffff1d8:     0x400a666666666666

For the program compiled with GCC 3.1 without using -m64:

    Breakpoint 1, main () at double.c:9
    9               printf("d1 = %f\n", d1);
    (gdb) p d1
    Cannot access memory at address 0xffbef3a0
    (gdb) x/xg &d1
    0xffbef3a0:     0x400a666666666666
    (gdb) x/fg &d1
    0xffbef3a0:     1.8626433728741176e-10

GDB 5.2 built for the non-64 bit sparc-sun-solaris2.8 works properly
with this program compiled with GCC 3.1 without using -m64.

GCC 3.1 was compiled like this:

Configured with: ../configure --with-gcc-version-trigger=/usr/local/gnu/src/gcc-
3.1/gcc/gcc/version.c --host=sparc-sun-solaris2.8 --prefix=/usr/local/gnu --exec
-prefix=/usr/local/gnu/sparc-sun-solaris2.8 --enable-shared --program-suffix=-3.
1 --enable-threads --enable-version-specific-runtime-libs : (reconfigured) ../co
nfigure --with-gcc-version-trigger=/usr/local/gnu/src/gcc-3.1/gcc/gcc/version.c
--host=sparc-sun-solaris2.8 --prefix=/usr/local/gnu --exec-prefix=/usr/local/gnu
/sparc-sun-solaris2.8 --enable-shared --program-suffix=-3.1 --enable-threads --e
nable-version-specific-runtime-libs

GDB 5.2 was compiled with GCC 3.1 like this:

../configure --host=sparc64-sun-solaris2.8 --with-gcc=gcc-3.1 --prefix=/usr/loca
l/gnu --exec-prefix=/usr/local/gnu/sparc64-sun-solaris2.8 --norecursion
>How-To-Repeat:
See description.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]