Skip to content

Commit 7c94858

Browse files
pprindevillerafaeljw
authored andcommitted
ACPICA: Fix GCC 12 dangling-pointer warning
ACPICA commit aea0a5cfce262ce2ab16fd96d87c12cf5e756380 We're storing a persistent pointer to an ephemeral local variable which technically is a dangling pointer and the compiler is correct. However, since we never indirect the pointer, this is a safe operation and we can suppress the warning. Also, some C run-times (like MUSL) aren't including <stdint.h> indirectly so we must include it explicitly or we won't have the type definition for uintptr_t. Fixes issue #867. Link: acpica/acpica@aea0a5cf Signed-off-by: Philip Prindeville <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 06c2afb commit 7c94858

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/acpi/acpica/utdebug.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ void acpi_ut_init_stack_ptr_trace(void)
3737
{
3838
acpi_size current_sp;
3939

40+
#pragma GCC diagnostic push
41+
#if defined(__GNUC__) && __GNUC__ >= 12
42+
#pragma GCC diagnostic ignored "-Wdangling-pointer="
43+
#endif
4044
acpi_gbl_entry_stack_pointer = &current_sp;
45+
#pragma GCC diagnostic pop
4146
}
4247

4348
/*******************************************************************************

include/acpi/platform/aclinux.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
#ifdef ACPI_USE_STANDARD_HEADERS
183183
#include <stddef.h>
184184
#include <unistd.h>
185+
#include <stdint.h>
185186

186187
#define ACPI_OFFSET(d, f) offsetof(d, f)
187188
#endif

0 commit comments

Comments
 (0)