public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] ctype: Fix integer type for caseconv_entry::delta
Date: Mon, 30 Jul 2018 08:49:00 -0000	[thread overview]
Message-ID: <20180730084850.68531.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d8d18c3e80b029449240de8b3d970c03674e9617

commit d8d18c3e80b029449240de8b3d970c03674e9617
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Fri Jul 27 09:16:53 2018 +0200

    ctype: Fix integer type for caseconv_entry::delta
    
    The commit 46ba1675c457324b0eeef4670a09101ef3f34c50 accidently changed a
    bit-field from signed to unsigned.  The caseconv_entry::delta must be a
    signed integer, see also "newlib/libc/ctype/caseconv.t".
    
    Unfortunately, a standard GCC/Newlib build is done without
    -Wsign-conversion.  Using this warning option would have helped to avoid
    this bug:
    
    caseconv.t:2:22: warning: unsigned conversion from 'int' to 'unsigned int:17' changes value from '-32' to '131040' [-Wsign-conversion]
       {0x0061, 25, TOUP, -32},
    
    Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>

Diff:
---
 newlib/libc/ctype/towctrans_l.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/ctype/towctrans_l.c b/newlib/libc/ctype/towctrans_l.c
index 42085ac..7b8a23c 100644
--- a/newlib/libc/ctype/towctrans_l.c
+++ b/newlib/libc/ctype/towctrans_l.c
@@ -39,7 +39,7 @@ static struct caseconv_entry {
   uint_least32_t first: 21;
   uint_least8_t diff: 8;
   uint_least8_t mode: 2;
-  uint_least32_t delta: 17;
+  int_least32_t delta: 17;
 } __attribute__ ((packed))
 caseconv_table [] = {
 #include "caseconv.t"


                 reply	other threads:[~2018-07-30  8:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180730084850.68531.qmail@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).