[PATCH] acpica: Work around bogus -Wstringop-overread warning since GCC 11

Xi Ruoyao posted 1 patch 3 months, 2 weeks ago
drivers/acpi/acpica/tbprint.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] acpica: Work around bogus -Wstringop-overread warning since GCC 11
Posted by Xi Ruoyao 3 months, 2 weeks ago
When ACPI_MISALIGNMENT_NOT_SUPPORTED, GCC can produce a bogus
-Wstringop-overread warning, see https://gcc.gnu.org/PR122073.

To me it's very clear that we have a compiler bug here, thus just
disable the warning.

Cc: stable@vger.kernel.org
Fixes: a9d13433fe17 ("LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled")
Link: https://lore.kernel.org/all/899f2dec-e8b9-44f4-ab8d-001e160a2aed@roeck-us.net/
Link: https://github.com/acpica/acpica/commit/abf5b573
Co-developed-by: Saket Dumbre <saket.dumbre@intel.com>
Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 drivers/acpi/acpica/tbprint.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
index 049f6c2f1e32..e5631027f7f1 100644
--- a/drivers/acpi/acpica/tbprint.c
+++ b/drivers/acpi/acpica/tbprint.c
@@ -95,6 +95,11 @@ acpi_tb_print_table_header(acpi_physical_address address,
 {
 	struct acpi_table_header local_header;
 
+#pragma GCC diagnostic push
+#if defined(__GNUC__) && __GNUC__ >= 11
+#pragma GCC diagnostic ignored "-Wstringop-overread"
+#endif
+
 	if (ACPI_COMPARE_NAMESEG(header->signature, ACPI_SIG_FACS)) {
 
 		/* FACS only has signature and length fields */
@@ -143,4 +148,5 @@ acpi_tb_print_table_header(acpi_physical_address address,
 			   local_header.asl_compiler_id,
 			   local_header.asl_compiler_revision));
 	}
+#pragma GCC diagnostic pop
 }
-- 
2.51.1
Re: [PATCH] acpica: Work around bogus -Wstringop-overread warning since GCC 11
Posted by Rafael J. Wysocki 3 months, 2 weeks ago
On Tue, Oct 21, 2025 at 11:28 AM Xi Ruoyao <xry111@xry111.site> wrote:
>
> When ACPI_MISALIGNMENT_NOT_SUPPORTED, GCC can produce a bogus
> -Wstringop-overread warning, see https://gcc.gnu.org/PR122073.
>
> To me it's very clear that we have a compiler bug here, thus just
> disable the warning.
>
> Cc: stable@vger.kernel.org
> Fixes: a9d13433fe17 ("LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled")
> Link: https://lore.kernel.org/all/899f2dec-e8b9-44f4-ab8d-001e160a2aed@roeck-us.net/
> Link: https://github.com/acpica/acpica/commit/abf5b573
> Co-developed-by: Saket Dumbre <saket.dumbre@intel.com>
> Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>

Please submit ACPICA changes to the upstream ACPICA project on GitHub
as pull requests (PRs).  After a given PR has been merged upstream, a
corresponding Linux patch can be submitted with a Link: tag pointing
to the upstream commit, but note that upstream ACPICA material is
automatically transferred to Linux, so it should not be necessary to
do so unless timing is important.

> ---
>  drivers/acpi/acpica/tbprint.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
> index 049f6c2f1e32..e5631027f7f1 100644
> --- a/drivers/acpi/acpica/tbprint.c
> +++ b/drivers/acpi/acpica/tbprint.c
> @@ -95,6 +95,11 @@ acpi_tb_print_table_header(acpi_physical_address address,
>  {
>         struct acpi_table_header local_header;
>
> +#pragma GCC diagnostic push
> +#if defined(__GNUC__) && __GNUC__ >= 11
> +#pragma GCC diagnostic ignored "-Wstringop-overread"
> +#endif
> +
>         if (ACPI_COMPARE_NAMESEG(header->signature, ACPI_SIG_FACS)) {
>
>                 /* FACS only has signature and length fields */
> @@ -143,4 +148,5 @@ acpi_tb_print_table_header(acpi_physical_address address,
>                            local_header.asl_compiler_id,
>                            local_header.asl_compiler_revision));
>         }
> +#pragma GCC diagnostic pop
>  }
> --
> 2.51.1
>
Re: [PATCH] acpica: Work around bogus -Wstringop-overread warning since GCC 11
Posted by Xi Ruoyao 3 months, 2 weeks ago
On Tue, 2025-10-21 at 15:35 +0200, Rafael J. Wysocki wrote:
> On Tue, Oct 21, 2025 at 11:28 AM Xi Ruoyao <xry111@xry111.site> wrote:
> > 
> > When ACPI_MISALIGNMENT_NOT_SUPPORTED, GCC can produce a bogus
> > -Wstringop-overread warning, see https://gcc.gnu.org/PR122073.
> > 
> > To me it's very clear that we have a compiler bug here, thus just
> > disable the warning.
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: a9d13433fe17 ("LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled")
> > Link: https://lore.kernel.org/all/899f2dec-e8b9-44f4-ab8d-001e160a2aed@roeck-us.net/
> > Link: https://github.com/acpica/acpica/commit/abf5b573

/* snip */

> Please submit ACPICA changes to the upstream ACPICA project on GitHub
> as pull requests (PRs).  After a given PR has been merged upstream, a
> corresponding Linux patch can be submitted with a Link: tag pointing
> to the upstream commit, but note that upstream ACPICA material is
> automatically transferred to Linux, so it should not be necessary to
> do so unless timing is important.

The Link: tag is above.  The issue here is this bug is preventing
automatic test of arch/loongarch (see another Link: tag).
> 

-- 
Xi Ruoyao <xry111@xry111.site>
Re: [PATCH] acpica: Work around bogus -Wstringop-overread warning since GCC 11
Posted by Rafael J. Wysocki 3 months, 2 weeks ago
On Tue, Oct 21, 2025 at 3:43 PM Xi Ruoyao <xry111@xry111.site> wrote:
>
> On Tue, 2025-10-21 at 15:35 +0200, Rafael J. Wysocki wrote:
> > On Tue, Oct 21, 2025 at 11:28 AM Xi Ruoyao <xry111@xry111.site> wrote:
> > >
> > > When ACPI_MISALIGNMENT_NOT_SUPPORTED, GCC can produce a bogus
> > > -Wstringop-overread warning, see https://gcc.gnu.org/PR122073.
> > >
> > > To me it's very clear that we have a compiler bug here, thus just
> > > disable the warning.
> > >
> > > Cc: stable@vger.kernel.org
> > > Fixes: a9d13433fe17 ("LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled")
> > > Link: https://lore.kernel.org/all/899f2dec-e8b9-44f4-ab8d-001e160a2aed@roeck-us.net/
> > > Link: https://github.com/acpica/acpica/commit/abf5b573
>
> /* snip */
>
> > Please submit ACPICA changes to the upstream ACPICA project on GitHub
> > as pull requests (PRs).  After a given PR has been merged upstream, a
> > corresponding Linux patch can be submitted with a Link: tag pointing
> > to the upstream commit, but note that upstream ACPICA material is
> > automatically transferred to Linux, so it should not be necessary to
> > do so unless timing is important.
>
> The Link: tag is above.  The issue here is this bug is preventing
> automatic test of arch/loongarch (see another Link: tag).

OK, applied as 6.18-rc material with slightly edited subject and
changelog, thanks!
Re: [PATCH] acpica: Work around bogus -Wstringop-overread warning since GCC 11
Posted by Huacai Chen 3 months, 2 weeks ago
On Tue, Oct 21, 2025 at 5:28 PM Xi Ruoyao <xry111@xry111.site> wrote:
>
> When ACPI_MISALIGNMENT_NOT_SUPPORTED, GCC can produce a bogus
> -Wstringop-overread warning, see https://gcc.gnu.org/PR122073.
>
> To me it's very clear that we have a compiler bug here, thus just
> disable the warning.
>
> Cc: stable@vger.kernel.org
> Fixes: a9d13433fe17 ("LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled")
> Link: https://lore.kernel.org/all/899f2dec-e8b9-44f4-ab8d-001e160a2aed@roeck-us.net/
> Link: https://github.com/acpica/acpica/commit/abf5b573
> Co-developed-by: Saket Dumbre <saket.dumbre@intel.com>
> Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>

> ---
>  drivers/acpi/acpica/tbprint.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
> index 049f6c2f1e32..e5631027f7f1 100644
> --- a/drivers/acpi/acpica/tbprint.c
> +++ b/drivers/acpi/acpica/tbprint.c
> @@ -95,6 +95,11 @@ acpi_tb_print_table_header(acpi_physical_address address,
>  {
>         struct acpi_table_header local_header;
>
> +#pragma GCC diagnostic push
> +#if defined(__GNUC__) && __GNUC__ >= 11
> +#pragma GCC diagnostic ignored "-Wstringop-overread"
> +#endif
> +
>         if (ACPI_COMPARE_NAMESEG(header->signature, ACPI_SIG_FACS)) {
>
>                 /* FACS only has signature and length fields */
> @@ -143,4 +148,5 @@ acpi_tb_print_table_header(acpi_physical_address address,
>                            local_header.asl_compiler_id,
>                            local_header.asl_compiler_revision));
>         }
> +#pragma GCC diagnostic pop
>  }
> --
> 2.51.1
>