unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47307: Emacs 27.2 RC2 build/check issues on macOS ARM64
@ 2021-03-22  1:27 Paul Eggert
  2021-03-22  8:54 ` Michael Albinus
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Paul Eggert @ 2021-03-22  1:27 UTC (permalink / raw)
  To: 47307

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

I configured Emacs 27.2 RC2 on macOS 11.2 ARM64 (arm-apple-darwin20.3.0) 
using "./configure --with-gnutls=ifavailable" (plain "./configure" 
failed, which was disconcerting). When I ran "make" the compiler complained:

editfns.c:2063:18: warning: unsequenced modification and access to 
'sa_avail' [-Wunsequenced]

This correctly diagnoses undefined behavior in that C function. I didn't 
investigate what happens on that platform is as it's easier to fix the 
problem on all platforms. I propose installing the attached 
obviously-safe patch into the emacs-27 branch.

There were several deprecation warnings when compiling but I assume we 
don't care about them in this older branch.

"make check" reported four unexpected failures. Perhaps a macOS expert 
could be persuaded to look into them. A tarball of the failed logs is 
attached.

[-- Attachment #2: 0001-Fix-replace-buffer-contents-undefined-behavior.patch --]
[-- Type: text/x-patch, Size: 1496 bytes --]

From f85db942100f4a129d4b9efba5707b954cbf2121 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 21 Mar 2021 18:08:13 -0700
Subject: [PATCH] Fix replace-buffer-contents undefined behavior

* src/editfns.c (Freplace_buffer_contents): Avoid undefined
behavior with competing side effects in parallel subexpressions.
Problem reported by Apple clang version 12.0.0 (clang-1200.0.32.29).
---
 src/editfns.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index 621e35171d..cd9633d4c6 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2053,6 +2053,8 @@ DEFUN ("replace-buffer-contents", Freplace_buffer_contents,
      code.  */
   ptrdiff_t del_bytes = (size_t) size_a / CHAR_BIT + 1;
   ptrdiff_t ins_bytes = (size_t) size_b / CHAR_BIT + 1;
+  unsigned char *deletions = SAFE_ALLOCA (del_bytes);
+  unsigned char *insertions = SAFE_ALLOCA (ins_bytes);
   struct context ctx = {
     .buffer_a = a,
     .buffer_b = b,
@@ -2060,8 +2062,8 @@ DEFUN ("replace-buffer-contents", Freplace_buffer_contents,
     .beg_b = min_b,
     .a_unibyte = BUF_ZV (a) == BUF_ZV_BYTE (a),
     .b_unibyte = BUF_ZV (b) == BUF_ZV_BYTE (b),
-    .deletions = SAFE_ALLOCA (del_bytes),
-    .insertions = SAFE_ALLOCA (ins_bytes),
+    .deletions = deletions,
+    .insertions = insertions,
     .fdiag = buffer + size_b + 1,
     .bdiag = buffer + diags + size_b + 1,
     .heuristic = true,
-- 
2.27.0


[-- Attachment #3: emacs-27.2-RC2-failures-macOS11.2-ARM.tar.gz --]
[-- Type: application/gzip, Size: 4677 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-25 15:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  1:27 bug#47307: Emacs 27.2 RC2 build/check issues on macOS ARM64 Paul Eggert
2021-03-22  8:54 ` Michael Albinus
2021-03-22 16:23   ` Paul Eggert
2021-03-22 16:59 ` Philipp Stephani
2021-03-23  8:40   ` Michael Albinus
2021-03-22 17:20 ` Eli Zaretskii
2021-03-25 15:16   ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).