]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add comment in dwarf2read.c::read_subrange_type
authorJoel Brobecker <brobecker@adacore.com>
Wed, 26 Feb 2014 18:53:05 +0000 (10:53 -0800)
committerJoel Brobecker <brobecker@adacore.com>
Wed, 26 Feb 2014 18:54:27 +0000 (10:54 -0800)
This comment explains why we sometimes sign-extend the range type
bounds when we normally shouldn't have to.

gdb/ChangeLog:

        * dwarf2read.c (read_subrange_type): Add comment.

gdb/ChangeLog
gdb/dwarf2read.c

index 8f2f0dcfef5f9b5327ed81fb2a2c12ca799c8f40..49d81132430c9b1e260c584738c237d346c76070 100644 (file)
@@ -1,3 +1,7 @@
+2014-02-27  Joel Brobecker  <brobecker@adacore.com>
+
+       * dwarf2read.c (read_subrange_type): Add comment.
+
 2014-02-27  Joel Brobecker  <brobecker@adacore.com>
 
        * dwarf2read.c (update_enumeration_type_from_children): New
index 00bba472ada27e7d3775703e9dc2023d2118075a..52208d6dd5e15fef5f191d7499a26ea36b026cb0 100644 (file)
@@ -14522,6 +14522,13 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
        }
     }
 
+  /* Normally, the DWARF producers are expected to use a signed
+     constant form (Eg. DW_FORM_sdata) to express negative bounds.
+     But this is unfortunately not always the case, as witnessed
+     with GCC, for instance, where the ambiguous DW_FORM_dataN form
+     is used instead.  To work around that ambiguity, we treat
+     the bounds as signed, and thus sign-extend their values, when
+     the base type is signed.  */
   negative_mask =
     (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
   if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))