mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-11 05:51:21 -08:00
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).
This commit is contained in:
parent
720a8b17f8
commit
6a4ed891d8
1 changed files with 4 additions and 2 deletions
|
|
@ -2053,6 +2053,8 @@ nil. */)
|
|||
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 @@ nil. */)
|
|||
.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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue