https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12 Regression] Invalid |[11 Regression] Invalid
|warning -Wstringop-overflow |warning -Wstringop-overflow
|wrong argument |wrong argument
Known to fail| |11.2.0
--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed for GCC 12. The patch is far too intrusive to backport but the following
should fix the problem in GCC 11:
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);
}
}