]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Emit DW_AT_GNU_bias with -fgnat-encodings=gdb
authorTom Tromey <tromey@adacore.com>
Thu, 19 Sep 2019 08:14:57 +0000 (08:14 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 19 Sep 2019 08:14:57 +0000 (08:14 +0000)
Emit DW_AT_GNU_bias with -fgnat-encodings=gdb.  gdb implements this,
but not the encoded variant.

2019-09-19  Tom Tromey  <tromey@adacore.com>

gcc/ada/

* gcc-interface/misc.c (gnat_get_type_bias): Return the bias
when -fgnat-encodings=gdb.

gcc/testsuite/

* gnat.dg/bias1.adb: New testcase.

From-SVN: r275958

gcc/ada/ChangeLog
gcc/ada/gcc-interface/misc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/bias1.adb [new file with mode: 0644]

index 4208f958c60af2c3b4efdf2424dd33dc7bf89ef3..94b32fba566a4ef4395f714fea6ddeb699c852c4 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-19  Tom Tromey  <tromey@adacore.com>
+
+       * gcc-interface/misc.c (gnat_get_type_bias): Return the bias
+       when -fgnat-encodings=gdb.
+
 2019-09-19  Steve Baird  <baird@adacore.com>
 
        * sem_prag.adb (Preferred_String_Type): A new function. Given an
index a576b7e5a0160b0388fac24da920dc1d8a0d993f..4abd4d5708a540eb66d04b230da5a9df9e7125a8 100644 (file)
@@ -1111,7 +1111,7 @@ gnat_get_type_bias (const_tree gnu_type)
 {
   if (TREE_CODE (gnu_type) == INTEGER_TYPE
       && TYPE_BIASED_REPRESENTATION_P (gnu_type)
-      && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
+      && gnat_encodings != DWARF_GNAT_ENCODINGS_ALL)
     return TYPE_RM_MIN_VALUE (gnu_type);
 
   return NULL_TREE;
index cac70e28fba8fda0daedd734796b200c3f289f16..07adb119850ba0d9d85833ad7993f272b7216629 100644 (file)
@@ -1,3 +1,7 @@
+2019-09-19  Tom Tromey  <tromey@adacore.com>
+
+       * gnat.dg/bias1.adb: New testcase.
+
 2019-09-19  Steve Baird  <baird@adacore.com>
 
        * gnat.dg/annotation1.adb: New testcase.
diff --git a/gcc/testsuite/gnat.dg/bias1.adb b/gcc/testsuite/gnat.dg/bias1.adb
new file mode 100644 (file)
index 0000000..016a159
--- /dev/null
@@ -0,0 +1,34 @@
+--  { dg-do compile }
+--  { dg-options "-cargs -g -dA -gnatws -fgnat-encodings=gdb -margs" }
+--  { dg-final { scan-assembler "DW_AT_GNU_bias" } }
+
+procedure Bias1 is
+   type Small is range -7 .. -4;
+   for Small'Size use 2;
+   Y : Small := -5;
+   Y1 : Small := -7;
+
+   type Byte is mod 256;
+   type Repeat_Count_T is new Byte range 1 .. 2 ** 6;
+   for Repeat_Count_T'Size use 6;
+   X : Repeat_Count_T := 64;
+   X1 : Repeat_Count_T := 1;
+
+   type Char_Range is range 65 .. 68;
+   for Char_Range'Size use 2;
+   Cval : Char_Range := 65;
+
+   type SomePackedRecord is record
+      R: Small;
+      S: Small;
+   end record;
+   pragma Pack (SomePackedRecord);
+   SPR : SomePackedRecord := (R => -4, S => -5);
+
+   type Packed_Array is array (1 .. 3) of Small;
+   pragma pack (Packed_Array);
+   A : Packed_Array := (-7, -5, -4);
+
+begin
+   null;
+end Bias1;
\ No newline at end of file