Re: [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Jul 27 09:37, Sebastian Huber wrote:
> 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 <[email protected]>
> ---
>  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 42085ac78..7b8a23c9c 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"
> -- 
> 2.13.7

Thanks, please apply series.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAltev3MACgkQ9TYGna5E
T6BeQA//VZyc+35oID2zsomxe8ud0A31X99xxVbvFQBQiy9RI2hKXDaHiMFmQCDw
egzOQVnyt3HUCJaf1CNk/kbeicqYLbNynASg8wE3fmHL+D2fCMAlPxwsKHN8IbhB
7832zrdBx6rHKKOODbf4FPRmtAyJmI1+A57adSJOLuh5DPgLc5f559zc4l9th7rL
6rEm68Sz+hMPNxjTMq74Zp3Rgv/HI9xPfqF9451/oMy++D9XB2IIk1yP1jB/IBOk
7E6blPRfusAJwI79KyfB5lg0dZmKmP+XdeqQU+zV0yVmmcPMZtUmS35SWhKz10Gn
L7ulJNpYPefZGs0n5dIgrT5XikoGigZzKP0R7QQoVzX/ATCoS0uP+PZWlDS/z7LD
816SrkTaymO5shLMUMiQFCDdczntp3athw/0C1R5cYHLyIuzl1Qhn8Uh/aZfQ/Zb
OMm8TzLxwp9T5EcxBhEtJT/DyEU3EY1Ff9NWBATOSgajLy+FuWBOdOLsrzjVySn6
CBdLekHYfmcubMUUoZ43xGVWR0Da5BSzzgTHn/dwSoAw//SicxKLS/bVA3foPW5q
vhTNjkY0BofawhUO188oD7gU/uXrjpjrFnjGWneQ8AnfDJl5TNY0tk0nNY1y8UIj
mfYtypmzBRZNfcFMd2+DL3Jt/A95E5bKDrSwdNSVaekQxg/qHBc=
=VD+t
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.