[gnutls-dev] Re: Compiler warnings on 64bit archs

Simon Josefsson jas at extundo.com
Tue Aug 15 16:12:52 CEST 2006

Andreas Metzler <ametzler at downhill.at.eu.org> writes:

> On 2006-08-13 Simon Josefsson <jas at extundo.com> wrote:
>> Andreas Metzler <ametzler at downhill.at.eu.org> writes:
>>> After adding the missing AC_CHECK_SIZEOF(void *), this indeed works.
>>> So how would you like to have the 19 [1] occurences of this issue
>>> fixed, is there a central header file GNUTLS_POINTER_TO_INT can be
>>> thrown into (besides gnutls.h)?
>>> thanks, cu andreas
>>> [1]
>>> in gnutls-20060628.tar.gz:
>>> gnutls_openssl.c:283: warning: cast to pointer from integer of different size
> [...]
>> I've moved the macros to gnutls_int, and fixed the above warnings.
> Thanks. gnutls_openssl.c needs a 
> #include <gnutls_int.h>

I've fixed this by copying the macros instead.

>>> serv.c:954: warning: cast to pointer from integer of different size
>>> cli.c:831: warning: cast to pointer from integer of different size
> [...]
>> Those are not in the library, and from what I understand, the cast
>> isn't actually invalid -- the behaviour is what we intend and well
>> defined on all platforms we care about, isn't it?
> [...]
> I honestly do not know. GLIBS docs just says "The problem is that on
> some systems you need to do this: [...]", with this being the cast to
> (long).

I was referring to the warning itself -- is there actually anything
wrong with the code here?  What can go wrong and how?

We know that we can shut up the compiler by using this macro, but I'm
starting to have second thoughts whether we actually should do this.

Doesn't some standard specify what should happen when you cast an
integer to a pointer, when they have different sizes?

Even if the behaviour is undefined, are there any real-world systems
that break if we don't cast 'int' to 'long' before casting it to

We probably should have had this discussion before adding the macro,


More information about the Gnutls-devel mailing list