aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-02-18 21:04:28 +0000
committerTom Tromey <tromey@redhat.com>2013-02-18 21:04:28 +0000
commit4c9ad8c2c0acd2e73b895bbe9f9e7d87cd9a5b7c (patch)
tree0a4979c1875272fe6e48538d5a7706464276b64e /gdb/dwarf2read.c
parent4f3cee1ca11c3173ad1d4030f69b4b99a675bd26 (diff)
downloadgdb-4c9ad8c2c0acd2e73b895bbe9f9e7d87cd9a5b7c.zip
gdb-4c9ad8c2c0acd2e73b895bbe9f9e7d87cd9a5b7c.tar.gz
gdb-4c9ad8c2c0acd2e73b895bbe9f9e7d87cd9a5b7c.tar.bz2
PR gdb/15102:
* dwarf2read.c (read_subrange_type): Use result of 'check_typedef'. gdb/testsuite * gdb.dwarf2/subrange.exp: New file.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index d26e7c8..df6298b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -12736,7 +12736,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
static struct type *
read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
{
- struct type *base_type;
+ struct type *base_type, *orig_base_type;
struct type *range_type;
struct attribute *attr;
LONGEST low, high;
@@ -12744,9 +12744,12 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
const char *name;
LONGEST negative_mask;
- base_type = die_type (die, cu);
- /* Preserve BASE_TYPE's original type, just set its LENGTH. */
- check_typedef (base_type);
+ orig_base_type = die_type (die, cu);
+ /* If ORIG_BASE_TYPE is a typedef, it will not be TYPE_UNSIGNED,
+ whereas the real type might be. So, we use ORIG_BASE_TYPE when
+ creating the range type, but we use the result of check_typedef
+ when examining properties of the type. */
+ base_type = check_typedef (orig_base_type);
/* The die_type call above may have already set the type for this DIE. */
range_type = get_die_type (die, cu);
@@ -12876,7 +12879,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
high |= negative_mask;
- range_type = create_range_type (NULL, base_type, low, high);
+ range_type = create_range_type (NULL, orig_base_type, low, high);
/* Mark arrays with dynamic length at least as an array of unspecified
length. GDB could check the boundary but before it gets implemented at