KCoreaddons build failiure on ARM

Alexander Potashev aspotashev at gmail.com
Mon Jun 22 19:45:43 UTC 2015


2015-06-22 13:18 GMT+03:00 David Faure <faure at kde.org>:
> I don't follow. How does 0x858458F6 not fit into an int, even on a 32 bit
> machine?
> OK, this is just about signed/unsigned, not about really wider.
> So yeah the bug is that glibc should use unsigned int there instead,
> but the issue you mention "the comparison will fail" might not happen, if the
> comparison uses the right signedness. There is no truncation happening, at
> least.
>
> A static_cast<unsigned int> workaround in kcoreaddons would work in practice,
> no?

David,

I believe in the same theory you described.

I couldn't reproduce the error on clang x86_64, even though I tried
hard. The most I could get is a warning "overflow converting case
value to switch condition type (2240043254 to -2054924042)" when you
change 0x858458F6 to 0x858458F6LL to make it be not convertible to a
4-byte signed int (see attached .cpp file.)

The hack with static_cast<unsigned int>() helps here, but we need to
use something more portable than "unsigned int", because on x86_64
sizeof(statfs.f_type) == 8, i.e. differs from unsigned int.

-- 
Alexander Potashev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcoreaddons-int-const.cpp
Type: text/x-c++src
Size: 390 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150622/7215ba58/attachment.cpp>


More information about the Kde-frameworks-devel mailing list