summaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-27 19:37:35 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-27 19:37:35 +0000
commit776f6fe80393f609f9c83da0cc85cc240fb620b8 (patch)
treeeaa8c5783d5d40079e949e06d2ac1b67aee2e28f /gcc/real.c
parentd80c748dc59ca4dbfb5806bfe51fab8ecc29d1b9 (diff)
downloadgcc-776f6fe80393f609f9c83da0cc85cc240fb620b8.tar.gz
PR middle-end/47903
* real.c (real_arithmetic) <case PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR>: Clear padding bits in *r first if r isn't op0 nor op1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170547 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/real.c b/gcc/real.c
index 4318586110a..6d3b4356d23 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1,6 +1,7 @@
/* real.c - software floating point emulation.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
- 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
+ Free Software Foundation, Inc.
Contributed by Stephen L. Moshier (moshier@world.std.com).
Re-written by Richard Henderson <rth@redhat.com>
@@ -1009,15 +1010,25 @@ real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0,
switch (code)
{
case PLUS_EXPR:
+ /* Clear any padding areas in *r if it isn't equal to one of the
+ operands so that we can later do bitwise comparisons later on. */
+ if (r != op0 && r != op1)
+ memset (r, '\0', sizeof (*r));
return do_add (r, op0, op1, 0);
case MINUS_EXPR:
+ if (r != op0 && r != op1)
+ memset (r, '\0', sizeof (*r));
return do_add (r, op0, op1, 1);
case MULT_EXPR:
+ if (r != op0 && r != op1)
+ memset (r, '\0', sizeof (*r));
return do_multiply (r, op0, op1);
case RDIV_EXPR:
+ if (r != op0 && r != op1)
+ memset (r, '\0', sizeof (*r));
return do_divide (r, op0, op1);
case MIN_EXPR: