aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/compiler/aslanalyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslanalyze.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslanalyze.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c
index 17e2674817a9..625611a630de 100644
--- a/sys/contrib/dev/acpica/compiler/aslanalyze.c
+++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c
@@ -572,10 +572,22 @@ ApCheckForGpeNameConflict (
ACPI_PARSE_OBJECT *NextOp;
UINT32 GpeNumber;
char Name[ACPI_NAMESEG_SIZE + 1];
- char Target[ACPI_NAMESEG_SIZE];
+ char Target[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
- /* Need a null-terminated string version of NameSeg */
+ /**
+ * Need a null-terminated string version of NameSeg
+ *
+ * NOTE: during a review on Name[ACPI_NAMESEG_SIZE + 1] having an extra
+ * byte[1], compiler testing exhibited a difference in behavior between
+ * GCC and Clang[2] (at least; MSVC may also exhibit the same) in
+ * how optimization is done. The extra byte is needed to ensure
+ * the signature does not get mangled, subsequently avoiding
+ * GpeNumber being a completely different return value from strtoul.
+ *
+ * [1] https://github.com/acpica/acpica/pull/1019#discussion_r2058687704
+ * [2] https://github.com/acpica/acpica/pull/1019#discussion_r2061953039
+ */
ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);
Name[ACPI_NAMESEG_SIZE] = 0;