https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125730

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Already tree_to_aff_combination ((char * * *) (((unsigned long) first_kw_arg_12
+ (unsigned long) values_16(D)) - (unsigned long) argnames_11(D)), char ***)
strips the integer conversions which is because it uses STRIP_NOPS which
happily does.  Of course this irrevocably drops important information we cannot
conservatively recover (similar for signed/unsigned details) :/

The following fixes the testcase, selecting

  _20 = (sizetype) first_kw_arg_12;
  _26 = (sizetype) argnames_11(D);
  _27 = _20 - _26;
  # PT = nonlocal null
  _28 = values_16(D) + _27;
  MEM[(char * * *)_28 + ivtmp.11_8 * 1] = fetched_value.1_6;

but I fear some "massive" fallout.

diff --git a/gcc/tree-affine.cc b/gcc/tree-affine.cc
index b5b7249c675..a55074ba7b4 100644
--- a/gcc/tree-affine.cc
+++ b/gcc/tree-affine.cc
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dumpfile.h"
 #include "cfgexpand.h"
 #include "value-query.h"
+#include "tree-ssa.h"

 /* Extends CST as appropriate for the affine combinations COMB.  */

@@ -312,8 +313,7 @@ expr_to_aff_combination (aff_tree *comb, tree_code code,
tree type,
        tree itype = TREE_TYPE (inner);
        enum tree_code icode = TREE_CODE (inner);

-       /* STRIP_NOPS  */
-       if (tree_nop_conversion_p (otype, itype))
+       if (useless_type_conversion_p (otype, itype))
          {
            tree_to_aff_combination (op0, type, comb);
            return true;
@@ -394,7 +394,7 @@ tree_to_aff_combination (tree expr, tree type, aff_tree
*comb)
   machine_mode mode;
   int unsignedp, reversep, volatilep;

-  STRIP_NOPS (expr);
+  STRIP_USELESS_TYPE_CONVERSION (expr);

   code = TREE_CODE (expr);
   switch (code)

Reply via email to