]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix sign of Ada rational constants
authorTom Tromey <tromey@adacore.com>
Fri, 2 May 2025 17:03:07 +0000 (11:03 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 5 May 2025 13:37:18 +0000 (07:37 -0600)
commitf3d834df28734ebc82931808960fe63401127c06
tree02931e05b508c6e4d57264c74fc3bfb63512142c
parent4011eaac9a1fce5c44fcabb12368159b3e899d84
Fix sign of Ada rational constants

My earlier patch commit 0c03db90 ("Use correct sign in get_mpz") was
(very) incorrect.  It changed get_mpz to check for a strict sign when
examining part of an Ada rational constant.  However, in Ada the
"delta" for a fixed-point type must be positive, and so the components
of the rational representation will be positive.

This patch corrects the error.  It also renames the get_mpz function,
in case anyone is tempted to reuse this code for another purpose.

Finally, this pulls over the test from the internal AdaCore test suite
that found this issue.
gdb/dwarf2/read.c
gdb/testsuite/gdb.ada/fixed_points.exp
gdb/testsuite/gdb.ada/fixed_points/fixed_points.adb