[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-23 Thread linkw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

--- Comment #7 from Kewen Lin  ---
Sorry that I didn't catch the bugzilla mails timely, thanks for fixing this!

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed.

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Fri Nov 22 18:17:04 2019
New Revision: 278626

URL: https://gcc.gnu.org/viewcvs?rev=278626=gcc=rev
Log:
PR tree-optimization/92618
* tree-ssa-reassoc.c (v_info): Change from auto_vec to a struct
containing the auto_vec and a tree.
(undistribute_bitref_for_vector): Handle the case when element type
of vec is not the same as type of the BIT_FIELD_REF.  Formatting
fixes.

* gcc.c-torture/compile/pr92618.c: New test.
* gcc.c-torture/execute/pr92618.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr92618.c
trunk/gcc/testsuite/gcc.c-torture/execute/pr92618.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

--- Comment #4 from Jakub Jelinek  ---
Created attachment 47332
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47332=edit
gcc10-pr92618.patch

Untested fix.

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

--- Comment #3 from Jakub Jelinek  ---
That optimization seems to ignore completely the involved types.

Consider following testcase instead, where in foo the addition is performed
originally in unsigned long long type and in baz in double type, that reassoc
change happily performs the addition in long long type in both cases.

#if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__
typedef long long __m128i __attribute__((__may_alias__, __vector_size__(2 *
sizeof (long long;

unsigned long long b[4];
__m128i bar (void);
double e[4];

void
foo (unsigned long long *x)
{
  __m128i c = bar ();
  __m128i d = bar ();
  *(__m128i *) [0] = c;
  *(__m128i *) [2] = d;
  *x = b[0] + b[1] + b[2] + b[3];
}

void
baz (double *x)
{
  __m128i c = bar ();
  __m128i d = bar ();
  *(__m128i *) [0] = c;
  *(__m128i *) [2] = d;
  *x = e[0] + e[1] + e[2] + e[3];
}
#endif

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Testcase in C and with fewer casts, plus portable between -m32/-m64:
typedef long long __m128i __attribute__((__may_alias__, __vector_size__(2 *
sizeof (long long;

void
foo (__m128i *x)
{
  __m128i a;
  *x = a;
}

void
bar (__m128i *x)
{
  foo (x);
  foo (x + 1);
}

unsigned long long b[4];

void
baz (long long *x)
{
  bar ((__m128i *) b);
  *x = b[0] + b[1] + b[2] + b[3];
}

[Bug tree-optimization/92618] [10 Regression] error: type mismatch in binary expression in reassoc since r273490

2019-11-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92618

Martin Liška  changed:

   What|Removed |Added

   Priority|P3  |P1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-11-21
  Known to work||9.2.0
   Target Milestone|--- |10.0
 Ever confirmed|0   |1
  Known to fail||10.0

--- Comment #1 from Martin Liška  ---
Seen in gdal2 package.