From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 03BF33858D28; Sun, 17 Oct 2021 18:37:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03BF33858D28 From: "jacob at jacob dot remcomp.fr" To: gdb-prs@sourceware.org Subject: [Bug c++/28465] New: Problems wit long double data in gdb ARM 64 aarch64 Date: Sun, 17 Oct 2021 18:37:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: jacob at jacob dot remcomp.fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2021 18:37:17 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28465 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 int main(void) { long double d1=3D19.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 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: . Find the GDB manual and other documentation resources online at: . 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=20 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=20 Breakpoint 1, main () at tgh.c:4 4 long double d1=3D19.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 instruct= ion single step: (gdb) run Starting program: /home/jacob/lcc/book/test/a.out=20 Breakpoint 1, main () at tgh.c:4 4 long double d1=3D19.76; (gdb) display/3i $pc-4 1: x/3i $pc-4 0x5555555844 : mov x29, sp =3D> 0x5555555848 : ldr q0, 0x5555555870 0x555555584c : str q0, [x29,#16] (gdb) print *(long double *)0x5555555870 $4 =3D 19.760000000000001563194018672220409 The correct data is at the specified address!!!!!!!!!!!!! (gdb) nexti 0x000000555555584c 4 long double d1=3D19.76; 1: x/3i $pc-4 0x5555555848 : ldr q0, 0x5555555870 =3D> 0x555555584c : str q0, [x29,#16] 0x5555555850 : adrp x0, 0x5555555000 (gdb) print $q0 $5 =3D {u =3D 0xf947e0009000008097ffffeb97ffffe4, s =3D 0xf947e0009000008097ffffeb97ffffe4} (gdb) print (long double)$q0 $6 =3D -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=20 https://www.pine64.org/devices/single-board-computers/rock64/ --=20 You are receiving this mail because: You are on the CC list for the bug.=