]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
avoid unwarranted assumption in gdb.ada/fixed_points/fixed_points.adb
authorJoel Brobecker <brobecker@adacore.com>
Sun, 1 Nov 2020 11:37:41 +0000 (15:37 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Sun, 1 Nov 2020 11:37:41 +0000 (15:37 +0400)
The test program being used declares a fixed-point type
(Base_Fixed_Point_Type) Base_Fixed_Point_Type whose (scaled) range
is System.Min_Int .. System.Max_Int. is an unwarranted assumption because
the range is implementation-defined. It means the compiler is therefore
free to reject that declaration.

We noticed this while one of my coworkers was working on enhancing
GNAT to support 128bit integers. The bulk of the work has been done,
but one side-effect is that there is a small gap in this particular
area where the compiler is now rejecting this code. We will eventually
plug that gap, but in meantime, since the testcase itself doesn't really
need such a large range, this commit simply adjusts the test program
to use hard-coded bounds for the range whose value are more reasonable.

gdb/testsuite/ChangeLog:

        * gdb.ada/fixed_points/fixed_points.adb: Replace use of
        System.Min_Int and System.Max_Int with smaller hardcoded
        constants.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb

index 9b8370a4523f5372eda6eb5178c558bf144c51f4..5d752d80acc310dcd256bf001de5c485348e4e4e 100644 (file)
@@ -1,3 +1,9 @@
+2020-11-01  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdb.ada/fixed_points/fixed_points.adb: Replace use of
+       System.Min_Int and System.Max_Int with smaller hardcoded
+       constants.
+
 2020-10-31  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * configure.ac: Split AC_INIT into AC_INIT and AC_CONFIG_SRCDIR.
index dd45da8bfc62dd8cc393a13c892af66d1192e3c4..a2720e3a7208e62bb508a2e665af84c91ef2409d 100644 (file)
@@ -25,8 +25,7 @@ procedure Fixed_Points is
 
    type Base_Fixed_Point_Type is
      delta 1.0 / 16.0
-       range (System.Min_Int / 2) * 1.0 / 16.0 ..
-       (System.Max_Int / 2) * 1.0 / 16.0;
+     range -2147483648 * 1.0 / 16.0 ..  2147483647 * 1.0 / 16.0;
 
    subtype Fixed_Point_Subtype is
      Base_Fixed_Point_Type range -50.0 .. 50.0;