diff options
author | Martin Liska <mliska@suse.cz> | 2014-11-25 16:16:27 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2014-11-25 15:16:27 +0000 |
commit | 8301b194d24cb01e54f36822740ed5b835358fd1 (patch) | |
tree | 6eb6e13f7c1038e576c433fecfe7eea014d66df3 /gcc/sreal.h | |
parent | 6b4b59fc6f4b555f81e70e82dd424be2e05b41fc (diff) | |
download | gcc-8301b194d24cb01e54f36822740ed5b835358fd1.zip gcc-8301b194d24cb01e54f36822740ed5b835358fd1.tar.gz gcc-8301b194d24cb01e54f36822740ed5b835358fd1.tar.bz2 |
re PR bootstrap/64050 (r218009 causes LTO/PGO bootstrap failure: ICE: in inline_small_functions, at ipa-inline.c:1709)
2014-11-25 Martin Liska <mliska@suse.cz>
PR bootstrap/64050
PR ipa/64060
* sreal.c (sreal::operator+): Addition fixed.
(sreal::signedless_plus): Negative numbers are
handled correctly.
(sreal::operator-): Subtraction is fixed.
(sreal::signedless_minus): Negative numbers are
handled correctly.
* sreal.h (sreal::operator<): Equal negative numbers
are compared correctly.
(sreal::shift): New checking asserts are introduced.
Operation is fixed.
* gcc.dg/plugin/plugin.exp: New plugin.
* gcc.dg/plugin/sreal-test-1.c: New test.
* gcc.dg/plugin/sreal_plugin.c: New test.
From-SVN: r218048
Diffstat (limited to 'gcc/sreal.h')
-rw-r--r-- | gcc/sreal.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/sreal.h b/gcc/sreal.h index 1362bf6..3938c6e 100644 --- a/gcc/sreal.h +++ b/gcc/sreal.h @@ -60,6 +60,11 @@ public: bool operator< (const sreal &other) const { + /* We negate result in case of negative numbers and + it would return true for equal negative numbers. */ + if (*this == other) + return false; + if (m_negative != other.m_negative) return m_negative > other.m_negative; @@ -86,10 +91,19 @@ public: return tmp; } - sreal shift (int sig) const + sreal shift (int s) const { + gcc_checking_assert (s <= SREAL_BITS); + gcc_checking_assert (s >= -SREAL_BITS); + + /* Exponent should never be so large because shift_right is used only by + sreal_add and sreal_sub ant thus the number cannot be shifted out from + exponent range. */ + gcc_checking_assert (m_exp + s <= SREAL_MAX_EXP); + gcc_checking_assert (m_exp + s >= -SREAL_MAX_EXP); + sreal tmp = *this; - tmp.m_sig += sig; + tmp.m_exp += s; return tmp; } |