https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854
--- Comment #11 from nightstrike <nightstrike at gmail dot com> --- (In reply to Martin Sebor from comment #9) > Fixed for GCC 12. The patch is far too intrusive to backport but the > following should fix the problem in GCC 11: Would you mind applying it to 11? Thanks! Also, I think in your diff below, there's "// A nonnull" that should be "/* A nonnull"... / to * > diff --git a/gcc/calls.c b/gcc/calls.c > index fcb0d6dec69..f116923c890 100644 > --- a/gcc/calls.c > +++ b/gcc/calls.c > @@ -2295,14 +2295,15 @@ initialize_argument_information (int num_actuals > ATTRIBUTE_UNUSED, > operand for later processing. */ > if (attr_access *access = rdwr_idx.get (argpos)) > { > + int idx = i - !!struct_value_addr_value; > if (POINTER_TYPE_P (type)) > { > - access->ptr = args[i].tree_value; > + access->ptr = args[idx].tree_value; > // A nonnull ACCESS->SIZE contains VLA bounds. */ > } > else > { > - access->size = args[i].tree_value; > + access->size = args[idx].tree_value; > gcc_assert (access->ptr == NULL_TREE); > } > }