aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2019-09-17 08:02:56 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-17 08:02:56 +0000
commite34716b8dd8836a565b4cf0c26f7244161f194f1 (patch)
tree65a5f634701b28725bcded695f9b90b8a2b74351 /gcc/fortran/expr.c
parent0d4fcc9f622ee428849091c51108a4823819e9a6 (diff)
downloadgcc-e34716b8dd8836a565b4cf0c26f7244161f194f1.zip
gcc-e34716b8dd8836a565b4cf0c26f7244161f194f1.tar.gz
gcc-e34716b8dd8836a565b4cf0c26f7244161f194f1.tar.bz2
[Ada] Fix rounding of fixed-point arithmetic operation
Fixed-point multiplication, division and conversion may lead to calling the function Double_Divide in s-arit64 runtime unit. In the special case where arguments have the special values X = -2**63 and the absolute value of the product of its other arguments Y*Z = 2**64, the rounded value should be either -1 or 1, but currently Double_Divide returns a quotient of 0. Rounding only applies when Round attribute is called on the arithmetic operation for a decimal fixed-point result, or the result type is integer. This fixes correctly applies rounding away from 0 in that special case. 2019-09-17 Yannick Moy <moy@adacore.com> gcc/ada/ * libgnat/s-arit64.adb (Double_Divide): Correctly handle the special case when rounding. gcc/testsuite/ * gnat.dg/fixedpnt7.adb: New testcase. From-SVN: r275796
Diffstat (limited to 'gcc/fortran/expr.c')
0 files changed, 0 insertions, 0 deletions