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] Fix PR34458, ICE in data-ref with using int_cst_value


Fixed by using tree_low_cst instead.  For 4.4 we want to implement
int_cst_value in terms of tree_low_cst instead (or get rid of 
int_cst_value by replacing all callers) - not appropriate at this stage
though.

The problem is that int_cst_value insists on the constants type being
completely representable in a HOST_WIDE_INT.  But what (usually) matters
is, whether the actual constant fits in a HOST_WIDE_INT - which is
what tree_low_cst ensures.  64bit types are common, but constants that
do not fit in a 32bit type not, so this avoids the ICE.

Note this doesn't fix the fundamental problem with data-ref, and as
Zdenek mentions data-ref should possibly use double_ints for its
calculations.

But this is an easy and obvious fix here.  Bootstrap and regtest in
progress, I'll apply this after it completes.

Thanks,
Richard.

2008-01-09  Richard Guenther  <rguenther@suse.de>

	PR middle-end/34458
	* tree-data-ref.c (initialize_matrix_A): Use tree_low_cst.

	* gcc.c-torture/compile/pr34458.c: New testcase.

Index: tree-data-ref.c
===================================================================
*** tree-data-ref.c	(revision 131422)
--- tree-data-ref.c	(working copy)
*************** initialize_matrix_A (lambda_matrix A, tr
*** 1826,1834 ****
    gcc_assert (chrec);
  
    if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
!     return int_cst_value (chrec);
  
!   A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
    return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
  }
  
--- 1826,1834 ----
    gcc_assert (chrec);
  
    if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
!     return tree_low_cst (chrec, 0);
  
!   A[index][0] = mult * tree_low_cst (CHREC_RIGHT (chrec), 0);
    return initialize_matrix_A (A, CHREC_LEFT (chrec), index + 1, mult);
  }
  
Index: testsuite/gcc.c-torture/compile/pr34458.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr34458.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr34458.c	(revision 0)
***************
*** 0 ****
--- 1,16 ----
+ /* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+ 
+ typedef struct
+ {
+   int data[1024];
+ }
+ Lint;
+ Lint lint_operate (Lint a, long long ammount)
+ {
+   int index;
+   Lint ret;
+   for (index = 0; index < 24; index++)
+     ret.data[index] =
+       a.data[index + ammount / 32 + 1] << a.data[index + ammount / 32];
+   return ret;
+ }


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