[patch] Fix PR34458: ICE in int_cst_value due to data dependence analysis

Richard Guenther richard.guenther@gmail.com
Thu Jan 3 23:06:00 GMT 2008


On Jan 3, 2008 10:59 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> Data dependence analysis is performing some computations on HWI
> integers, but the size of the host integers is not always large enough
> to keep all the bits.  This patch converts integer_cst nodes to
> integer_type_node if the needed precision is larger than what the host
> machine can handle.  The data dependence analysis should use GMP for
> all these computations..., until that day, the attached patch should
> fix the ICE that we see in PR34458.  Attached patch was regstrapped on
> amd64-linux without regressions, as you can see below.  Committed to
> trunk.

Err, this simply truncates the value.  In general you should use tree_low_cst
instead of int_cst_value, that will succed to return a HOST_WIDE_INT if
the value fits, not only if the precision ensures it will always fit.

Now, as of using GMP, it looks like the double_int helpers will be of more
use - especially as for example

- -  A[index][0] = mult * int_cst_value (CHREC_RIGHT (chrec));
+  A[index][0] = mult * dd_int_cst_value (CHREC_RIGHT (chrec));

looks like it still can overflow.

In these cases - truncation or overflow, will data-dependency cause wrong-code?

Finally, if you want to really truncate, instead of

+/* Return the HWI converted value of X.  */
+
+static inline HOST_WIDE_INT
+dd_int_cst_value (tree x)
+{
+  if (TYPE_PRECISION (TREE_TYPE (x)) > HOST_BITS_PER_WIDE_INT)
+    x = fold_convert (integer_type_node, x);
+
+  return int_cst_value (x);
+}

you can simply use TREE_INT_CST_LOW (x).

Richard.

> Sebastian
> --
> AMD - GNU Tools
>
> ---------- Forwarded message ----------
> From:  <spop@gcc12.fsffrance.org>
> Date: Jan 3, 2008 1:20 AM
> Subject: [regtest] Results for 873_pr34458.diff.asc on x86_64-unknown-linux-gnu
> To: sebpop@gmail.com
>
>
> Checker: (2008_01_03_07_20_08): (cat /home/spop/state/testing/patched/report
> there are no regressions with your patch.
> Checker: (2008_01_03_07_20_08): tac)
> Checker: (2008_01_03_07_20_08): FAILs with patched version:
> Checker: (2008_01_03_07_20_08): (cat /home/spop/state/testing/patched/failed
> gcc.sum gcc.dg/tree-prof/bb-reorg.c
> libmudflap.sum libmudflap.c++/pass41-frag.cxx
> libstdc++.sum abi_check
> Checker: (2008_01_03_07_20_08): tac)
> Checker: (2008_01_03_07_20_08): FAILs with pristine version:
> Checker: (2008_01_03_07_20_08): (cat /home/spop/state/trunk/131273/failed
> gcc.sum gcc.dg/tree-prof/bb-reorg.c
> libmudflap.sum libmudflap.c++/pass41-frag.cxx
> libstdc++.sum abi_check
> Checker: (2008_01_03_07_20_08): tac)
> Checker: (2008_01_03_07_20_08): The files used for the validation of
> your patch are stored in /home/spop/state/patched/2008_01_03_07_20_08
> on the tester machine.
>



More information about the Gcc-patches mailing list