Bug 29416 - [gdb, testsuite/aarch64] FAIL: gdb.ada/literals.exp: print 16#ffffffffffffffff#
Summary: [gdb, testsuite/aarch64] FAIL: gdb.ada/literals.exp: print 16#ffffffffffffffff#
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: ada (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 13.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-27 09:56 UTC by Tom de Vries
Modified: 2022-07-30 06:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2022-07-27 09:56:15 UTC
On aarch64, I run into:
...
(gdb) print 16#ffffffffffffffff#^M
$7 = 18446744073709551615^M
(gdb) FAIL: gdb.ada/literals.exp: print 16#ffffffffffffffff#
...

On x86_64 instead, I get:
...
(gdb) print 16#ffffffffffffffff#^M
$7 = -1^M
(gdb) PASS: gdb.ada/literals.exp: print 16#ffffffffffffffff#
...

I can reproduce this on x86_64-linux using:
...
$ gdb -q -batch -ex "set lang ada" -ex "set arch i386" -ex "print 16#ffffffffffffffff#"
The target architecture is set to "i386".
$1 = -1
$ gdb -q -batch -ex "set lang ada" -ex "set arch aarch64" -ex "print 16#ffffffffffffffff#"
The target architecture is set to "aarch64".
$1 = 18446744073709551615
...
Comment 1 Tom de Vries 2022-07-27 10:09:52 UTC
With i386, we have:
...
(gdb) p int_bits
$3 = 32
(gdb) p long_bits
$4 = 32
(gdb) p long_long_bits
$5 = 64
...
so in processInt we hit the fits-in-unsigned-long-long case where we use as type long long, so we have:
...
      /* Note: Interprets ULLONG_MAX as -1.  */                                       
      yylval.typed_val.type = type_long_long (par_state);                             ...

With aarch64, we have:
...
(gdb) p int_bits
$1 = 32
(gdb) p long_bits
$2 = 64
(gdb) p long_long_bits
$3 = 64
...
so in processInt we hit the fits-in-unsigned-long case and we use type unsigned long:
...
      yylval.typed_val.type                                                           
        = builtin_type (par_state->gdbarch ())->builtin_unsigned_long;                ...

This explains the difference between the two results.
Comment 3 Tom de Vries 2022-07-29 14:30:45 UTC
Status: waiting for Joel / adacore to come back to say how they want it fixed ( https://sourceware.org/pipermail/gdb-patches/2022-July/191129.html ).