Subject: Re: bug#32276: char-width of a space is 0 when display-table entry has a face.

From: Paul Eggert <[email-masked]>
Date: Sat, 28 Jul 2018 15:37:50 -0700

Unfortunately that change causes the emacs-26 build to fail for me:

make[1]: Entering directory '/home/eggert/src/gnu/emacs/emacs-26-sc/src'
   CC       character.o
In file included from character.c:34:0:
character.c: In function ‘char_width’:
lisp.h:1682:11: error: ‘c’ may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
     ? ((a) + (unsigned) 0) op ((b) + (unsigned) 0)   \
            ^
character.c:292:10: note: ‘c’ was declared here
       int c;
           ^
cc1: all warnings being treated as errors
Makefile:376: recipe for target 'character.o' failed

Although the attached patch fixes this and presumably speeds up the code a bit 
when optimized, is this the right thing to do? I have not looked into the code 
carefully.
From 4c321dc8d6b059ddaf5aab137aadbae18a3cb5af Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 28 Jul 2018 15:36:04 -0700
Subject: [PATCH] Adjust recent Bug#32276 fix

* src/character.c (char_width): Make explicit the assumption that
a display character vector element is a character if is not a
glyph code.
---
 src/character.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/character.c b/src/character.c
index 48268e0..6af9825 100644
--- a/src/character.c
+++ b/src/character.c
@@ -293,8 +293,11 @@ char_width (int c, struct Lisp_Char_Table *dp)
 	    ch = AREF (disp, i);
 	    if (GLYPH_CODE_P (ch))
 	      c = GLYPH_CODE_CHAR (ch);
-	    else if (CHARACTERP (ch))
-	      c = XFASTINT (ch);
+	    else
+	      {
+		eassert (CHARACTERP (ch));
+		c = XFASTINT (ch);
+	      }
 	    int w = CHARACTER_WIDTH (c);
 	    if (INT_ADD_WRAPV (width, w, &width))
 	      string_overflow ();
-- 
2.7.4