https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84095
--- Comment #5 from Arnd Bergmann <arnd at linaro dot org> --- Here are some additional instances in the kernel. I'm currently trying to get a reliable build first and haven't got a log of all the messages, but there are a number of changes I did that are related, shutting up the -Wrestrict warning (some may be -Warray-bounds). Here are some false-positives: --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c @@ -282,9 +282,7 @@ static void mux_clone(int cpu) if (!has_mux()) return; - memcpy(per_cpu(cpu_msrs, cpu).multiplex, - per_cpu(cpu_msrs, 0).multiplex, - sizeof(struct op_msr) * model->num_virt_counters); + per_cpu(cpu_msrs, cpu).multiplex = per_cpu(cpu_msrs, 0).multiplex; } #else @@ -463,6 +461,7 @@ static int nmi_setup(void) if (!cpu) continue; +#ifdef CONFIG_SMP memcpy(per_cpu(cpu_msrs, cpu).counters, per_cpu(cpu_msrs, 0).counters, sizeof(struct op_msr) * model->num_counters); @@ -470,7 +469,7 @@ static int nmi_setup(void) memcpy(per_cpu(cpu_msrs, cpu).controls, per_cpu(cpu_msrs, 0).controls, sizeof(struct op_msr) * model->num_controls); - +#endif mux_clone(cpu); } --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -1643,7 +1643,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy spin_lock_bh(&pmlmepriv->lock); if (request->n_channels == 1) { for (i = 1;i<survey_times_for_one_ch;i++) - memcpy(&ch[i], &ch[0], sizeof(struct rtw_ieee80211_channel)); + ch[i] = ch[0]; _status = rtw_sitesurvey_cmd(padapter, ssid, RTW_SSID_SCAN_AMOUNT, ch, survey_times_for_one_ch); } else if (request->n_channels <= 4) { for (j =request->n_channels-1;j>= 0;j--) This one was weird, I suspect my change is incorrect: diff --git a/drivers/fmc/fmc-fakedev.c b/drivers/fmc/fmc-fakedev.c index 941d0930969a..0d322380d952 100644 --- a/drivers/fmc/fmc-fakedev.c +++ b/drivers/fmc/fmc-fakedev.c @@ -305,7 +305,7 @@ static int ff_init(void) /* Replicate the default eeprom for the max number of mezzanines */ for (i = 1; i < FF_MAX_MEZZANINES; i++) - memcpy(ff_eeimg[i], ff_eeimg[0], sizeof(ff_eeimg[0])); + memcpy(&ff_eeimg[i][0], &ff_eeimg[0][0], sizeof(ff_eeimg[0])); if (ff_nr_eeprom > ff_nr_dev) ff_nr_dev = ff_nr_eeprom; This one seems to be a kernel bug: --- a/kernel/debug/kdb/kdb_support.c +++ b/kernel/debug/kdb/kdb_support.c @@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) } if (i >= ARRAY_SIZE(kdb_name_table)) { debug_kfree(kdb_name_table[0]); - memcpy(kdb_name_table, kdb_name_table+1, + memmove(kdb_name_table, kdb_name_table+1, sizeof(kdb_name_table[0]) * (ARRAY_SIZE(kdb_name_table)-1)); } else { debug_kfree(knt1); knt1 = kdb_name_table[i]; - memcpy(kdb_name_table+i, kdb_name_table+i+1, + memmove(kdb_name_table+i, kdb_name_table+i+1, sizeof(kdb_name_table[0]) * (ARRAY_SIZE(kdb_name_table)-i-1)); }