Fix biased integer arithmetic
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Nov 2020 14:08:16 +0000 (15:08 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Nov 2020 14:08:16 +0000 (15:08 +0100)
commit4e1a215870a4194c9ca884ef838103c094aa38c8
tree5d7691de83cb47420e00970c33c7748cf95a4b70
parentec1b8711945e99677fe5b135d343781bc2e106ad
Fix biased integer arithmetic

The Ada compiler uses a biased representation when a size clause reserves
fewer bits than normal either for the lower or for the upper bound.

gcc/ada/ChangeLog:
* gcc-interface/trans.c (build_binary_op_trapv): Convert operands
to the result type before doing generic overflow checking.

gcc/testsuite/ChangeLog:
* gnat.dg/bias2.adb: New test.
gcc/ada/gcc-interface/trans.c
gcc/testsuite/gnat.dg/bias2.adb [new file with mode: 0644]