GNU bug report logs -
#18743
25.0.50; Clang 3.0 fails to compile src/fns.c, GCC 4.8 cannot dump emacs
Previous Next
Reported by: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
Date: Wed, 15 Oct 2014 20:57:01 UTC
Severity: normal
Tags: notabug, unreproducible, wontfix
Found in version 25.0.50
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
Message #16 received at 18743 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Peter Dyballa <Peter_Dyballa <at> Freenet.DE> writes:
> With Clang 3.0 I still get this error:
> Other versions of Clang build GNU Emacs.
So only 3.0 fails with this, while both earlier and later versions
succeed?
> fns.c:1929:16: error: read-only variable is not assignable
> *dest++ = *a++;
> ~^
>
I guess the following should fix it, though I'm not sure if it's worth
doing.
[0001-Don-t-increment-array-Bug-18743.patch (text/x-diff, inline)]
From b7e08e341c19e1d2c8b1105ea1d94979577dbd02 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 28 Nov 2017 20:54:00 -0500
Subject: [PATCH] Don't increment array (Bug#18743)
* src/fns.c (merge_vectors): Use integer indexes instead of
incrementing pointers.
---
src/fns.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/fns.c b/src/fns.c
index 9db9bea9f7..e4ff0924b9 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1812,27 +1812,26 @@ merge_vectors (Lisp_Object pred,
Lisp_Object dest[VLA_ELEMS (alen + blen)])
{
eassume (0 < alen && 0 < blen);
- Lisp_Object const *alim = a + alen;
- Lisp_Object const *blim = b + blen;
+ ptrdiff_t ai = 0, bi = 0, di = 0;
while (true)
{
- if (inorder (pred, a[0], b[0]))
+ if (inorder (pred, a[ai], b[bi]))
{
- *dest++ = *a++;
- if (a == alim)
+ dest[di++] = a[ai++];
+ if (ai >= alen)
{
if (dest != b)
- memcpy (dest, b, (blim - b) * sizeof *dest);
+ memcpy (&dest[di], &b[bi], (blen - bi) * sizeof *dest);
return;
}
}
else
{
- *dest++ = *b++;
- if (b == blim)
+ dest[di++] = b[bi++];
+ if (bi >= blen)
{
- memcpy (dest, a, (alim - a) * sizeof *dest);
+ memcpy (&dest[di], &a[ai], (alen - ai) * sizeof *dest);
return;
}
}
--
2.11.0
This bug report was last modified 7 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.