[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0c11c2ae71f 10/16: Pacify GCC 13 -Wanalyzer-out-of-bounds
From: |
Paul Eggert |
Subject: |
master 0c11c2ae71f 10/16: Pacify GCC 13 -Wanalyzer-out-of-bounds |
Date: |
Sun, 14 May 2023 22:28:25 -0400 (EDT) |
branch: master
commit 0c11c2ae71fcc03d98b35384d6c70e6d7454ba90
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
Pacify GCC 13 -Wanalyzer-out-of-bounds
* src/alloc.c (NEAR_STACK_TOP): Hoist from here ...
* src/thread.h: ... to here.
* src/print.c (print_object): Use NEAR_STACK_TOP instead of raw
buffer address. This is more natural, and pacifies GCC 13.
---
src/alloc.c | 9 ---------
src/print.c | 2 +-
src/thread.h | 9 +++++++++
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 6391ede8d0a..29393deeff4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5338,15 +5338,6 @@ typedef union
#endif
} stacktop_sentry;
-/* Yield an address close enough to the top of the stack that the
- garbage collector need not scan above it. Callers should be
- declared NO_INLINE. */
-#ifdef HAVE___BUILTIN_FRAME_ADDRESS
-# define NEAR_STACK_TOP(addr) ((void) (addr), __builtin_frame_address (0))
-#else
-# define NEAR_STACK_TOP(addr) (addr)
-#endif
-
/* Set *P to the address of the top of the stack. This must be a
macro, not a function, so that it is executed in the caller's
environment. It is not inside a do-while so that its storage
diff --git a/src/print.c b/src/print.c
index e65b4c40b0e..6320c38fc6b 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2204,7 +2204,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun,
bool escapeflag)
max ((sizeof " with data 0x"
+ (sizeof (uintmax_t) * CHAR_BIT + 4 - 1) / 4),
40)))];
- current_thread->stack_top = buf;
+ current_thread->stack_top = NEAR_STACK_TOP (buf);
print_obj:
maybe_quit ();
diff --git a/src/thread.h b/src/thread.h
index f0e9ee01173..9b14cc44f35 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -33,6 +33,15 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include "sysselect.h" /* FIXME */
#include "systhread.h"
+/* Yield an address close enough to the top of the stack that the
+ garbage collector need not scan above it. Callers should be
+ declared NO_INLINE. */
+#ifdef HAVE___BUILTIN_FRAME_ADDRESS
+# define NEAR_STACK_TOP(addr) ((void) (addr), __builtin_frame_address (0))
+#else
+# define NEAR_STACK_TOP(addr) (addr)
+#endif
+
INLINE_HEADER_BEGIN
/* Byte-code interpreter thread state. */
- master updated (e7dc30c1d58 -> ebf5e4ca1cd), Paul Eggert, 2023/05/14
- master b77d357ea35 01/16: Update from Gnulib by running admin/merge-gnulib, Paul Eggert, 2023/05/14
- master 8c0671b9cbf 02/16: Avoid duplicate configure-time codeset tests, Paul Eggert, 2023/05/14
- master 3e3f34d71e9 03/16: Fix ebrowse -f buffer overflow, Paul Eggert, 2023/05/14
- master 92d4bda2797 04/16: Fix movemail fd leak, Paul Eggert, 2023/05/14
- master 0c11c2ae71f 10/16: Pacify GCC 13 -Wanalyzer-out-of-bounds,
Paul Eggert <=
- master 85c4efc9f41 14/16: Prefer UINTMAX_WIDTH in print_object, Paul Eggert, 2023/05/14
- master 919e1b81a4a 11/16: Pacify GCC 13 -Wnull-dereference in itree.c, Paul Eggert, 2023/05/14
- master 67ee74f8e55 05/16: Pacify GCC 13 -fanalyzer in tty_menu_activate, Paul Eggert, 2023/05/14
- master 0b9677a192b 07/16: Work around GCC bug 109579 in ccl.c, Paul Eggert, 2023/05/14
- master 0f5b1fcdf0b 13/16: Help GCC compute modiff_incr, Paul Eggert, 2023/05/14
- master 7166737b5c9 06/16: Work around GCC bug 109577, Paul Eggert, 2023/05/14
- master 9eef5a678c3 08/16: Do not use -Wanalyzer-fd-leak, Paul Eggert, 2023/05/14
- master 4fedd5af4cc 09/16: Work around GCC bug 109847 in buffer.c, Paul Eggert, 2023/05/14
- master 3cd8ce87d29 12/16: Work after 2038 on 32-bit GNU/Linux, Paul Eggert, 2023/05/14
- master 9f8a5989b65 15/16: Prefer PTRDIFF_WIDTH in sort.c, Paul Eggert, 2023/05/14