middle-end: Fix incorrect type replacement in operands_equals [PR118472]
In g:3c32575e5b6370270d38a80a7fa8eaa144e083d0 I made a mistake and incorrectly replaced the type of the arguments of an expression with the type of the expression. This is of course wrong. This reverts that change and I have also double checked the other replacements and they are fine. gcc/ChangeLog: PR middle-end/118472 * fold-const.cc (operand_compare::operand_equal_p): Fix incorrect replacement. gcc/testsuite/ChangeLog: PR middle-end/118472 * gcc.dg/pr118472.c: New test.
This commit is contained in:
parent
bea593f115
commit
25eb892a8c
2 changed files with 34 additions and 1 deletions
|
@ -3746,7 +3746,8 @@ operand_compare::operand_equal_p (tree type0, const_tree arg0,
|
|||
of op1. Need to check to make sure they are the same. */
|
||||
if (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
|
||||
&& TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST
|
||||
&& TYPE_PRECISION (type0) != TYPE_PRECISION (type1))
|
||||
&& TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 1)))
|
||||
!= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 1))))
|
||||
return false;
|
||||
/* FALLTHRU */
|
||||
|
||||
|
|
32
gcc/testsuite/gcc.dg/pr118472.c
Normal file
32
gcc/testsuite/gcc.dg/pr118472.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O3 -fopenmp-simd" } */
|
||||
|
||||
typedef int a;
|
||||
typedef struct {
|
||||
a b __attribute__((__vector_size__(8)));
|
||||
} c;
|
||||
|
||||
typedef a d __attribute__((__vector_size__(8)));
|
||||
c e, f, g;
|
||||
d h, j;
|
||||
void k() {
|
||||
c l;
|
||||
l.b[1] = 0;
|
||||
c m = l;
|
||||
__builtin_memcpy(&h, &m, sizeof(h));
|
||||
j = h;
|
||||
{
|
||||
c l;
|
||||
l.b[1] = 0;
|
||||
m = l;
|
||||
__builtin_memcpy(&h, &m, sizeof(h));
|
||||
d m = j;
|
||||
__builtin_memcpy(&g, &m, sizeof(g));
|
||||
e = g;
|
||||
m = h;
|
||||
__builtin_memcpy(&g, &m, sizeof(g));
|
||||
#pragma omp simd
|
||||
for (long i = 0; i < f.b[0]; i++)
|
||||
f.b[i] = e.b[i] > g.b[i];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue