aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2017-11-27 19:45:56 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2017-11-27 19:45:56 +0000
commit32c95bcae37789ad601e557249310d7fd4444c7b (patch)
tree38542748b2e3e88e19378ff65a0d1154384482c2 /gcc/varasm.c
parent0f42ffd7f7c416a0702de90d2b0b374e877dc33b (diff)
downloadgcc-32c95bcae37789ad601e557249310d7fd4444c7b.zip
gcc-32c95bcae37789ad601e557249310d7fd4444c7b.tar.gz
gcc-32c95bcae37789ad601e557249310d7fd4444c7b.tar.bz2
[gcc]
2017-11-27 Michael Meissner <meissner@linux.vnet.ibm.com> PR middle_end/82333 * varasm.c (compare_constant): Take the mode of the constants into account when comparing floating point constants. [gcc/testsuite] 2017-11-27 Michael Meissner <meissner@linux.vnet.ibm.com> PR middle_end/82333 * gcc.target/powerpc/pr82333.c: New test. From-SVN: r255177
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index ff912b7..0c7b26e 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3118,10 +3118,16 @@ compare_constant (const tree t1, const tree t2)
return tree_int_cst_equal (t1, t2);
case REAL_CST:
- /* Real constants are the same only if the same width of type. */
+ /* Real constants are the same only if the same width of type. In
+ addition to the same width, we need to check whether the modes are the
+ same. There might be two floating point modes that are the same size
+ but have different representations, such as the PowerPC that has 2
+ different 128-bit floating point types (IBM extended double and IEEE
+ 128-bit floating point). */
if (TYPE_PRECISION (TREE_TYPE (t1)) != TYPE_PRECISION (TREE_TYPE (t2)))
return 0;
-
+ if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)))
+ return 0;
return real_identical (&TREE_REAL_CST (t1), &TREE_REAL_CST (t2));
case FIXED_CST: