Don't inherit range-type signed-ness from underlying type
authorTom Tromey <tromey@adacore.com>
Mon, 26 Oct 2020 18:54:19 +0000 (12:54 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 26 Oct 2020 19:00:41 +0000 (13:00 -0600)
commit6390859caa7684ff195d57e9f5cc02eae89bdb95
tree12ac1d26010823c93a9146af1434b11d6279cd11
parentd744f0f9652ee8de839c09e4517b18c9b88aecb7
Don't inherit range-type signed-ness from underlying type

A recent commit changed gdb to inherit the signed-ness of a range type
from its underlying type:

    commit cfabbd351a174406fd5aa063303f5c8bf9266bbc
    Author: Tom Tromey <tom@tromey.com>
    Date:   Sat Oct 17 11:41:59 2020 -0600

      Make range types inherit signed-ness from base type

This passed testing -- but unfortunately, additional testing at
AdaCore showed that this change was incorrect.  GNAT, at least, can
emit an unsigned range type whose underlying type is signed.

This patch reverts the code change from the above.  I chose not to
reintroduce the FIXME comments, because now we know that they are
incorrect.  Instead, this patch also adds a comment to
create_range_type.

A new test case is included as well.

2020-10-26  Tom Tromey  <tromey@adacore.com>

* gdbtypes.c (create_range_type): Revert previous patch.  Add
comment.

gdb/testsuite/ChangeLog
2020-10-26  Tom Tromey  <tromey@adacore.com>

* gdb.ada/unsigned_range/foo.adb: New file.
* gdb.ada/unsigned_range/pack.adb: New file.
* gdb.ada/unsigned_range/pack.ads: New file.
* gdb.ada/unsigned_range.exp: New file.
gdb/ChangeLog
gdb/gdbtypes.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/unsigned_range.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/unsigned_range/foo.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/unsigned_range/pack.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/unsigned_range/pack.ads [new file with mode: 0644]