lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Issue with gcc 6.3 s390x with 32 bit - format error ?


From: address@hidden
Subject: Re: [lwip-devel] Issue with gcc 6.3 s390x with 32 bit - format error ?
Date: Thu, 18 Oct 2018 21:02:52 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 18.10.2018 00:46, Ivan Warren wrote:
Hello all,

I am getting the following error on git head while cross compiling
lwipcore (x64->s390x) on debian :

/home/ivan/lwip/src/lwip/src/core/mem.c:1005:54: error: format ‘%u’
expects argument of type ‘unsigned int’, but argument 2 has type ‘size_t
{aka long unsigned int}’ [-Werror=format=]
       LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("mem_calloc:
could not allocate %"SZT_F" bytes\n", alloc_size));

This is very odd since I am compiling this (through a wrapper) with gcc
-m31 (read -m32 .. the 31 is a s390/s390x quirk) and "unsigned int" have
exactly the same width and sign as "long unsigned int" (32 bit unsigned
value) - so should NOT trigger the gcc warning ! (gcc bug ?)

I don't think this is a bug in gcc. Can you dig into the headers to see what size_t is typedef'ed to for your cross compiler?
And what PRIuPTR is defined to?

We use PRIuPTR as default as it seems to work for most targets. However, just today, I stumbled about one target where it also doesn't seem to work.

If you're using gcc, using "zu" is probably best, but this one is not really standard accross all compilers (and/or C standard versions in gcc as well?), so I don't know if it's good to use as a default for SZT_F ...

To me there is no error in lwip at this point (SZT_F is defined in
arch.h as PRIuPTR which should work just fine).

To me there is no error in lwIP, either: you can always override the default in your port ;-) And honestly, this is why it is overridable: size_t can be 'unsigned int' or 'long unsigned int', I guess there are platforms where both is OK. But unfortunately, we can't know which is the correct one.

Simon



reply via email to

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