diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-03 15:40:46 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-03 15:40:46 +0000 |
commit | 4c1d6cb30c0d9e9816d43cec0459901e880e84be (patch) | |
tree | 69ac6a51f03e9c01cdff2b69290b007143c2cc8f /gcc/ada/s-arit64.adb | |
parent | b5bf14af2826f3a769b248299bd4aa258c59bfdc (diff) | |
download | gcc-4c1d6cb30c0d9e9816d43cec0459901e880e84be.tar.gz |
* s-arit64.adb (Double_Divide): Put back changes that got accidentally
removed during the previous update (test properly for case of dividing
largest negative number by -1, which generates overflow).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92847 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-arit64.adb')
-rw-r--r-- | gcc/ada/s-arit64.adb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ada/s-arit64.adb b/gcc/ada/s-arit64.adb index 869a18eda53..fc1d2a0ad5e 100644 --- a/gcc/ada/s-arit64.adb +++ b/gcc/ada/s-arit64.adb @@ -232,6 +232,19 @@ package body System.Arith_64 is end if; Du := Lo (T2) & Lo (T1); + + -- Set final signs (RM 4.5.5(27-30)) + + Den_Pos := (Y < 0) = (Z < 0); + + -- Check overflow case of largest negative number divided by 1 + + if X = Int64'First and then Du = 1 and then not Den_Pos then + Raise_Error; + end if; + + -- Perform the actual division + Qu := Xu / Du; Ru := Xu rem Du; @@ -241,10 +254,6 @@ package body System.Arith_64 is Qu := Qu + Uns64'(1); end if; - -- Set final signs (RM 4.5.5(27-30)) - - Den_Pos := (Y < 0) = (Z < 0); - -- Case of dividend (X) sign positive if X >= 0 then |