* [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c
2018-07-27 7:40 [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta Sebastian Huber
@ 2018-07-27 7:37 ` Sebastian Huber
2018-07-27 10:51 ` Andre Vieira (lists)
2018-07-30 7:37 ` [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta Corinna Vinschen
1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Huber @ 2018-07-27 7:37 UTC (permalink / raw)
To: newlib; +Cc: Andre.SimoesDiasVieira
The previous version genenerated the following GCC note:
towctrans_l.c:44:1: note: offset of packed bit-field 'diff' has changed in GCC 4.4
caseconv_table [] = {
^~~~~~~~~~~~~~
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/ctype/towctrans_l.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/ctype/towctrans_l.c b/newlib/libc/ctype/towctrans_l.c
index 7b8a23c9c..b829266a4 100644
--- a/newlib/libc/ctype/towctrans_l.c
+++ b/newlib/libc/ctype/towctrans_l.c
@@ -37,8 +37,8 @@ enum {TO1, TOLO, TOUP, TOBOTH};
enum {EVENCAP, ODDCAP};
static struct caseconv_entry {
uint_least32_t first: 21;
- uint_least8_t diff: 8;
- uint_least8_t mode: 2;
+ uint_least32_t diff: 8;
+ uint_least32_t mode: 2;
int_least32_t delta: 17;
} __attribute__ ((packed))
caseconv_table [] = {
--
2.13.7
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta
@ 2018-07-27 7:40 Sebastian Huber
2018-07-27 7:37 ` [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c Sebastian Huber
2018-07-30 7:37 ` [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta Corinna Vinschen
0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Huber @ 2018-07-27 7:40 UTC (permalink / raw)
To: newlib; +Cc: Andre.SimoesDiasVieira
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>
---
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c
2018-07-27 7:37 ` [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c Sebastian Huber
@ 2018-07-27 10:51 ` Andre Vieira (lists)
2018-08-01 13:28 ` Sebastian Huber
0 siblings, 1 reply; 5+ messages in thread
From: Andre Vieira (lists) @ 2018-07-27 10:51 UTC (permalink / raw)
To: Sebastian Huber, newlib
On 27/07/18 08:37, Sebastian Huber wrote:
> The previous version genenerated the following GCC note:
>
> towctrans_l.c:44:1: note: offset of packed bit-field 'diff' has changed in GCC 4.4
> caseconv_table [] = {
> ^~~~~~~~~~~~~~
>
> Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
> ---
> newlib/libc/ctype/towctrans_l.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/newlib/libc/ctype/towctrans_l.c b/newlib/libc/ctype/towctrans_l.c
> index 7b8a23c9c..b829266a4 100644
> --- a/newlib/libc/ctype/towctrans_l.c
> +++ b/newlib/libc/ctype/towctrans_l.c
> @@ -37,8 +37,8 @@ enum {TO1, TOLO, TOUP, TOBOTH};
> enum {EVENCAP, ODDCAP};
> static struct caseconv_entry {
> uint_least32_t first: 21;
> - uint_least8_t diff: 8;
> - uint_least8_t mode: 2;
> + uint_least32_t diff: 8;
> + uint_least32_t mode: 2;
> int_least32_t delta: 17;
> } __attribute__ ((packed))
> caseconv_table [] = {
>
That fixes it, thanks Sebastian!
Cheers,
Andre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta
2018-07-27 7:40 [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta Sebastian Huber
2018-07-27 7:37 ` [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c Sebastian Huber
@ 2018-07-30 7:37 ` Corinna Vinschen
1 sibling, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2018-07-30 7:37 UTC (permalink / raw)
To: Sebastian Huber; +Cc: newlib, Andre.SimoesDiasVieira
[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]
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 <sebastian.huber@embedded-brains.de>
> ---
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c
2018-07-27 10:51 ` Andre Vieira (lists)
@ 2018-08-01 13:28 ` Sebastian Huber
0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Huber @ 2018-08-01 13:28 UTC (permalink / raw)
To: Andre Vieira (lists), newlib
Hello Andre,
On 27/07/18 12:43, Andre Vieira (lists) wrote:
> On 27/07/18 08:37, Sebastian Huber wrote:
>> The previous version genenerated the following GCC note:
>>
>> towctrans_l.c:44:1: note: offset of packed bit-field 'diff' has changed in GCC 4.4
>> caseconv_table [] = {
>> ^~~~~~~~~~~~~~
>>
>> Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
>> ---
>> newlib/libc/ctype/towctrans_l.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/newlib/libc/ctype/towctrans_l.c b/newlib/libc/ctype/towctrans_l.c
>> index 7b8a23c9c..b829266a4 100644
>> --- a/newlib/libc/ctype/towctrans_l.c
>> +++ b/newlib/libc/ctype/towctrans_l.c
>> @@ -37,8 +37,8 @@ enum {TO1, TOLO, TOUP, TOBOTH};
>> enum {EVENCAP, ODDCAP};
>> static struct caseconv_entry {
>> uint_least32_t first: 21;
>> - uint_least8_t diff: 8;
>> - uint_least8_t mode: 2;
>> + uint_least32_t diff: 8;
>> + uint_least32_t mode: 2;
>> int_least32_t delta: 17;
>> } __attribute__ ((packed))
>> caseconv_table [] = {
>>
> That fixes it, thanks Sebastian!
would you mind testing Newlib 6158b30e3e9b1b582ae60b15d64e775fa1705483.
It includes a fix for this bug, some FreeBSD compatibility changes in
<sys/cdefs.h> and a new configuration option for all targets
newlib/configure.host. Maybe we can use this commit for a new snapshot.
The broken ctype support in the latest snapshot introduced by me is not
really great.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-01 8:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 7:40 [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta Sebastian Huber
2018-07-27 7:37 ` [PATCH 2/2] ctype: Avoid GCC note in towctrans_l.c Sebastian Huber
2018-07-27 10:51 ` Andre Vieira (lists)
2018-08-01 13:28 ` Sebastian Huber
2018-07-30 7:37 ` [PATCH 1/2] ctype: Fix integer type for caseconv_entry::delta Corinna Vinschen
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).