public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28465] New: Problems wit long double data in gdb ARM 64 aarch64
@ 2021-10-17 18:37 jacob at jacob dot remcomp.fr
  2021-10-22 15:15 ` [Bug c++/28465] " tromey at sourceware dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2021-10-17 18:37 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28465

            Bug ID: 28465
           Summary: Problems wit long double data in gdb ARM 64 aarch64
           Product: gdb
           Version: 9.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: jacob at jacob dot remcomp.fr
  Target Milestone: ---

Dear friends:
Consider the following program

jacob@rock64:~/lcc/book/test$ cat tgh.c
#include <stdio.h>
int main(void)
{
        long double d1=19.76;
        printf("%Lg\n",d1);
}

I compile it:
jacob@rock64:~/lcc/book/test$ gcc -g tgh.c
Then, I run it:
jacob@rock64:~/lcc/book/test$ ./a.out
19.76
I start gdb
jacob@rock64:~/lcc/book/test$ gdb a.out

GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...done.
(gdb) run
Starting program: /home/jacob/lcc/book/test/a.out 
19.76
[Inferior 1 (process 4233) exited normally]

Now, I set a breakpoint:
Breakpoint 1 at 0x5555555848: file tgh.c, line 4.
(gdb) run
Starting program: /home/jacob/lcc/book/test/a.out 

Breakpoint 1, main () at tgh.c:4
4               long double d1=19.76;
(gdb) c
Continuing.
-3.7745e+4414
[Inferior 1 (process 4236) exited normally]

The output is completely wrong!!!!!!!!

The problem becomes even more strange if I follow the program with instruction
single step:

(gdb) run
Starting program: /home/jacob/lcc/book/test/a.out 

Breakpoint 1, main () at tgh.c:4
4               long double d1=19.76;
(gdb) display/3i $pc-4
1: x/3i $pc-4
   0x5555555844 <main+4>:       mov     x29, sp
=> 0x5555555848 <main+8>:       ldr     q0, 0x5555555870
   0x555555584c <main+12>:      str     q0, [x29,#16]
(gdb) print *(long double *)0x5555555870
$4 = 19.760000000000001563194018672220409

The correct data is at the specified address!!!!!!!!!!!!!

(gdb) nexti
0x000000555555584c      4               long double d1=19.76;
1: x/3i $pc-4
   0x5555555848 <main+8>:       ldr     q0, 0x5555555870
=> 0x555555584c <main+12>:      str     q0, [x29,#16]
   0x5555555850 <main+16>:      adrp    x0, 0x5555555000
(gdb) print $q0
$5 = {u = 0xf947e0009000008097ffffeb97ffffe4, s =
0xf947e0009000008097ffffeb97ffffe4}
(gdb) print (long double)$q0
$6 = -inf

Apparently the "ldd" instructions does NOT load the data at the specified
address!!!!!

What is going on???????

jacob@rock64:~/lcc/book/test$ uname -a
Linux rock64 4.4.152-rockchip64 #1 SMP Sun Aug 26 14:40:54 CEST 2018 aarch64
GNU/Linux
This is the "rock64" small machine (ARM CPU) available at 
https://www.pine64.org/devices/single-board-computers/rock64/

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-09  8:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-17 18:37 [Bug c++/28465] New: Problems wit long double data in gdb ARM 64 aarch64 jacob at jacob dot remcomp.fr
2021-10-22 15:15 ` [Bug c++/28465] " tromey at sourceware dot org
2021-10-28 12:01 ` jacob at jacob dot remcomp.fr
2021-10-28 18:56 ` simon.marchi at polymtl dot ca
2022-09-01 16:22 ` luis.machado at arm dot com
2022-09-09  8:56 ` luis.machado at arm dot com
2022-09-09  8:56 ` luis.machado at arm dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).