Skip to content

Commit dfa4aef

Browse files
author
meissner
committed
[gcc]
2017-11-27 Michael Meissner <[email protected]> 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 <[email protected]> PR middle_end/82333 * gcc.target/powerpc/pr82333.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255177 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 7494e98 commit dfa4aef

File tree

4 files changed

+53
-2
lines changed

4 files changed

+53
-2
lines changed

gcc/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2017-11-27 Michael Meissner <[email protected]>
2+
3+
PR middle_end/82333
4+
* varasm.c (compare_constant): Take the mode of the constants into
5+
account when comparing floating point constants.
6+
17
2017-11-27 Gerald Pfeifer <[email protected]>
28

39
* hash-set.h (DEFINE_DEBUG_HASH_SET): Remove static qualifier

gcc/testsuite/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-11-27 Michael Meissner <[email protected]>
2+
3+
PR middle_end/82333
4+
* gcc.target/powerpc/pr82333.c: New test.
5+
16
2017-11-27 Jakub Jelinek <[email protected]>
27

38
PR c++/81675
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* { dg-do compile { target { powerpc*-*-linux* } } } */
2+
/* { dg-require-effective-target ppc_float128_sw } */
3+
/* { dg-require-effective-target vsx_hw } */
4+
/* { dg-options "-mvsx -O2 -mabi=ibmlongdouble -Wno-psabi" } */
5+
6+
/* PR 82333 was an internal compiler abort where the compiler thought that a
7+
long double _Complex constant was the same as __float128 _Complex. */
8+
9+
_Complex long double vld;
10+
_Complex _Float128 vf128;
11+
12+
_Complex long double
13+
fld (_Complex long double arg0)
14+
{
15+
return 0;
16+
}
17+
18+
_Complex _Float128
19+
ff128 (_Complex _Float128 arg0)
20+
{
21+
return 0;
22+
}
23+
24+
void
25+
tld (void)
26+
{
27+
vld = fld (vld);
28+
}
29+
30+
void
31+
tf128 (void)
32+
{
33+
vf128 = ff128 (vf128);
34+
}

gcc/varasm.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3118,10 +3118,16 @@ compare_constant (const tree t1, const tree t2)
31183118
return tree_int_cst_equal (t1, t2);
31193119

31203120
case REAL_CST:
3121-
/* Real constants are the same only if the same width of type. */
3121+
/* Real constants are the same only if the same width of type. In
3122+
addition to the same width, we need to check whether the modes are the
3123+
same. There might be two floating point modes that are the same size
3124+
but have different representations, such as the PowerPC that has 2
3125+
different 128-bit floating point types (IBM extended double and IEEE
3126+
128-bit floating point). */
31223127
if (TYPE_PRECISION (TREE_TYPE (t1)) != TYPE_PRECISION (TREE_TYPE (t2)))
31233128
return 0;
3124-
3129+
if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)))
3130+
return 0;
31253131
return real_identical (&TREE_REAL_CST (t1), &TREE_REAL_CST (t2));
31263132

31273133
case FIXED_CST:

0 commit comments

Comments
 (0)