This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] for PR 31383


Hello,

affine_function_equal_p may be used to compare functions in different
numbers of variables (e.g. if one of the functions is constant, we do
not fill in the zero coefficients at the other variables of the
function).  Hence the assert in affine_function_equal_p is wrong,
and needs to be turned to returning false in order to fix this PR.

Bootstrapped & regtested on i686, commited.

Zdenek

	PR tree-optimization/31383
	* tree-data-ref.c (affine_function_equal_p): Do not require the vectors
	to have the same length.

Index: tree-data-ref.c
===================================================================
*** tree-data-ref.c	(revision 123340)
--- tree-data-ref.c	(working copy)
*************** affine_function_equal_p (affine_fn fna, 
*** 2069,2075 ****
  {
    unsigned i, n = VEC_length (tree, fna);
  
!   gcc_assert (n == VEC_length (tree, fnb));
  
    for (i = 0; i < n; i++)
      if (!operand_equal_p (VEC_index (tree, fna, i),
--- 2069,2076 ----
  {
    unsigned i, n = VEC_length (tree, fna);
  
!   if (n != VEC_length (tree, fnb))
!     return false;
  
    for (i = 0; i < n; i++)
      if (!operand_equal_p (VEC_index (tree, fna, i),


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]