|
From: | Nathan Du |
Subject: | [bug-gnu-libiconv] Compiler warnings regarding casting pointer to `long` on some platforms |
Date: | Fri, 20 Jan 2023 03:13:21 +0000 |
Hello.
When compiling libiconv on x86_64-w64-
mingw32, GCC raises compiler warnings that
does not occur on x86_64-*-linux-gnu. This
bug is not found by me, but by someone else
working on MSYS2, a project aiming to provide
a Unix-like development environment on W32.
The offending files are automatically generated
using `genaliases.c` and `genaliases2.c`. The
lines resulting in compiler warnings are written
at
of `genaliases.c`, and
of `genalaiases2.c`.
The code assumes that sizeof(long) is equal to
sizeof(void *). This however does not always
hold true. A notable example is W32 running
on AMD64, where sizeof(long) equals
sizeof(int32_t), which isn’t equal to the size of
`void *`.
For portability, we may need to cast to a type
other than `long`. gperf generated code, for
example, casts to `size_t`, and we should
probably follow suit. Other sensible choices
include casting to `intptr_t`.
Nathan Du
|
[Prev in Thread] | Current Thread | [Next in Thread] |