Bug#217541: fficonfig.h bogus on x86
Please could you submit this as an upstream report at
http://gcc.gnu.org/bugzilla/enter_bug.cgi and then give the upstream
PR number here on the Debian report?
Andreas Rottmann writes:
> Andreas Rottmann <rotty@debian.org> writes:
>
> > As you can easily see, the two pointers refer to the same object, which
> > means fficonfig.h #defines ffi_type_ulong to ffi_type_uint64, which is
> > plain wrong on a 32bit platform.
> >
> s/fficonfig.h/ffi.h/
>
> The way ffi.h #defines the ffi_type_XX equivalents to the standard c
> types seems fucked up - they have them along with the #defines of the
> fixed-bit types (e.g. UINT32), but the two issues are orthogonal. I
> have attached a patch that should fix this, and furthermore adds
> #defines for 'long long' and 'unsigned long long'. Hope something like
> this can go upstream.
>
> --- /usr/include/ffi.h 2003-10-17 13:13:15.000000000 +0200
> +++ /home/andy/include/g-wrap/ffi.h 2003-10-25 18:41:41.000000000 +0200
> @@ -79,76 +79,99 @@
> #define SINT8 signed char
>
> +/* 16 bit types */
> #if SIZEOF_INT == 2
>
> #define UINT16 unsigned int
> #define SINT16 int
> -#define ffi_type_uint ffi_type_uint16
> -#define ffi_type_sint ffi_type_sint16
>
> -#else
> -#if SIZEOF_SHORT == 2
> +#elif SIZEOF_SHORT == 2
>
> #define UINT16 unsigned short
> #define SINT16 short
> -#define ffi_type_ushort ffi_type_uint16
> -#define ffi_type_sshort ffi_type_sint16
>
> #endif
> -#endif
>
> +/* 32bit types */
> #if SIZEOF_INT == 4
>
> #define UINT32 unsigned int
> #define SINT32 int
> -#define ffi_type_uint ffi_type_uint32
> -#define ffi_type_sint ffi_type_sint32
>
> -#else
> -#if SIZEOF_SHORT == 4
> +#elif SIZEOF_SHORT == 4
>
> #define UINT32 unsigned short
> #define SINT32 short
> -#define ffi_type_ushort ffi_type_uint32
> -#define ffi_type_sshort ffi_type_sint32
>
> -#else
> -#if SIZEOF_LONG == 4
> +#elif SIZEOF_LONG == 4
>
> #define UINT32 unsigned long
> #define SINT32 long
> -#define ffi_type_ulong ffi_type_uint32
> -#define ffi_type_slong ffi_type_sint32
>
> #endif
> -#endif
> -#endif
>
> +
> +/* 64 bit types */
> #if SIZEOF_INT == 8
>
> #define UINT64 unsigned int
> #define SINT64 int
> -#define ffi_type_uint ffi_type_uint64
> -#define ffi_type_sint ffi_type_sint64
>
> -#else
> -#if SIZEOF_LONG == 8
> +#elif SIZEOF_LONG == 8
>
> #define UINT64 unsigned long
> #define SINT64 long
> -#define ffi_type_ulong ffi_type_uint64
> -#define ffi_type_slong ffi_type_sint64
>
> -#else
> -#if SIZEOF_LONG_LONG == 8
> +#elif SIZEOF_LONG_LONG == 8
>
> #define UINT64 unsigned long long
> #define SINT64 long long
> -#define ffi_type_ulong ffi_type_uint64
> -#define ffi_type_slong ffi_type_sint64
>
> #endif
> +
> +#if SIZEOF_INT == 2
> +
> +#define ffi_type_uint ffi_type_uint16
> +#define ffi_type_sint ffi_type_sint16
> +
> +#elif SIZEOF_INT == 4
> +
> +#define ffi_type_uint ffi_type_uint32
> +#define ffi_type_sint ffi_type_sint32
> +
> +#elif SIZEOF_INT == 8
> +
> +#define ffi_type_uint ffi_type_uint64
> +#define ffi_type_sint ffi_type_sint64
> +
> #endif
> +
> +#if SIZEOF_SHORT == 2
> +
> +#define ffi_type_ushort ffi_type_uint16
> +#define ffi_type_sshort ffi_type_sint16
> +
> +#elif SIZEOF_SHORT == 4
> +
> +#define ffi_type_ushort ffi_type_uint32
> +#define ffi_type_sshort ffi_type_sint32
> +
> +#endif /* guess there are no 64bit shorts anywhere? */
> +
> +#if SIZEOF_LONG == 4
> +
> +#define ffi_type_ulong ffi_type_uint32
> +#define ffi_type_slong ffi_type_sint32
> +
> +#elif SIZEOF_LONG == 8
> +
> +#define ffi_type_ulong ffi_type_uint64
> +#define ffi_type_slong ffi_type_sint64
> +
> #endif
>
> +/* any machines with 128bit long longs yet? */
> +#define ffi_type_ulong_long ffi_type_uint64
> +#define ffi_type_slong_long ffi_type_sint64
> +
> /* ---- System specific configurations ----------------------------------- */
>
>
> Cheers, Andi
> --
> Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at
> http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
> Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62
>
> Python is executable pseudocode, Perl is executable line-noise.
Reply to: