diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-10 06:05:20 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-10 06:05:20 +0000 |
commit | 36637ccfdb619fec5a2c898650d8184c35590c26 (patch) | |
tree | 6662d230285c32d3a4907f4ab10a6a31374e848c /gcc/dfp.c | |
parent | 7a9202f59689f75f6096c4ff323df45a7f0f897d (diff) | |
download | gcc-36637ccfdb619fec5a2c898650d8184c35590c26.tar.gz |
PR debug/48928
* dfp.c (decimal_to_decnumber): Handle conversion from
dconst{1,2,m1,half}.
* gcc.dg/dfp/pr48928.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173606 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dfp.c')
-rw-r--r-- | gcc/dfp.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/gcc/dfp.c b/gcc/dfp.c index 5a18db9f52f..6e43d149cfc 100644 --- a/gcc/dfp.c +++ b/gcc/dfp.c @@ -1,6 +1,6 @@ /* Decimal floating point support. - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 + Free Software Foundation, Inc. This file is part of GCC. @@ -110,7 +110,33 @@ decimal_to_decnumber (const REAL_VALUE_TYPE *r, decNumber *dn) decNumberFromString (dn, "nan", &set); break; case rvc_normal: - gcc_assert (r->decimal); + if (!r->decimal) + { + /* dconst{1,2,m1,half} are used in various places in + the middle-end and optimizers, allow them here + as an exception by converting them to decimal. */ + if (memcmp (r, &dconst1, sizeof (*r)) == 0) + { + decNumberFromString (dn, "1", &set); + break; + } + if (memcmp (r, &dconst2, sizeof (*r)) == 0) + { + decNumberFromString (dn, "2", &set); + break; + } + if (memcmp (r, &dconstm1, sizeof (*r)) == 0) + { + decNumberFromString (dn, "-1", &set); + break; + } + if (memcmp (r, &dconsthalf, sizeof (*r)) == 0) + { + decNumberFromString (dn, "0.5", &set); + break; + } + gcc_unreachable (); + } decimal128ToNumber ((const decimal128 *) r->sig, dn); break; default: |