bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnu-libiconv] 'lib/canonical*.h' may have data type conflicts.


From: 1 1
Subject: [bug-gnu-libiconv] 'lib/canonical*.h' may have data type conflicts.
Date: Tue, 11 Jul 2023 11:03:55 +0000

Hi There.

I found that 'lib/canonical*.h' may have some 'int' to 'unsigned short' type 
conflicts.

The code in 'lib/canonical.h' is like this:

```
  (int)(long)&((struct stringpool_t *)0)->stringpool_str392,
```

But the code in 'lib/iconv.c' is this:

```
static const unsigned short all_canonical[] = {
      .........
# include "canonical.h"
      .........
};
```

Member in array 'all_canonical' 's type is 'unsigned short', but canonical 
data's type is 'int'.
It is OK in C, but when I moved it to C++, AppleClang in macOS X x86_64 
reported this type conflict error.

Maybe we can change '(int)(long) ...' to '(unsigned short)(long) ...' when 
generate canonical headers.
Like this:

```
  (unsigned short)(long)&((struct stringpool_t *)0)->stringpool_str392,
```

This can also pass the test, and at the same time, it can reduce the number of 
alarm messages for certain C language compilers and improve compilation speed.

Thank you.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]