]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/100727 - fix call expansion with WITH_SIZE_EXPR arg
authorRichard Biener <rguenther@suse.de>
Tue, 25 May 2021 08:21:41 +0000 (10:21 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 25 May 2021 09:11:02 +0000 (11:11 +0200)
call expansion used the result of get_base_address to switch between
ABIs - with get_base_address now never returning NULL we have to
re-instantiate the check in a more explicit way.  This also adjusts
mark_addressable to skip WITH_SIZE_EXPRs, consistent with how
build_fold_addr_expr handles it.

2021-05-25  Richard Biener  <rguenther@suse.de>

PR middle-end/100727
* calls.c (initialize_argument_information): Explicitely test
for WITH_SIZE_EXPR.
* gimple-expr.c (mark_addressable): Skip outer WITH_SIZE_EXPR.

gcc/calls.c
gcc/gimple-expr.c

index f3da1839dc5a321dc9b74df55087aedb8389a0d1..dd8ff2aa7cbb7260c9241e71101cf1f77c68d318 100644 (file)
@@ -2397,7 +2397,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
             already in memory, instead of making a copy.  Likewise if we want
             to make the copy in the callee instead of the caller.  */
          if ((call_from_thunk_p || callee_copies)
-             && (base = get_base_address (args[i].tree_value))
+             && TREE_CODE (args[i].tree_value) != WITH_SIZE_EXPR
+             && ((base = get_base_address (args[i].tree_value)), true)
              && TREE_CODE (base) != SSA_NAME
              && (!DECL_P (base) || MEM_P (DECL_RTL (base))))
            {
index b8c732b632a774ee379f014af3a8c5c6fe2105cc..c3211795d33dfffd5c7636d5387dfcb850b60572 100644 (file)
@@ -900,6 +900,8 @@ flush_mark_addressable_queue ()
 void
 mark_addressable (tree x)
 {
+  if (TREE_CODE (x) == WITH_SIZE_EXPR)
+    x = TREE_OPERAND (x, 0);
   while (handled_component_p (x))
     x = TREE_OPERAND (x, 0);
   if (TREE_CODE (x) == MEM_REF