[Debian-med-packaging] Bug#852839: [Help] How to fix type issue on 32bit archs in C++ (Was: Bug#852839: baitfisher: FTBFS (32-bit): mixes ::size_t and faststring::size_t)

James Cowgill jcowgill at debian.org
Mon Dec 11 10:04:37 UTC 2017


Hi,

On 11/12/17 08:57, Andreas Tille wrote:
> control: tags -1 help
> 
> Hi,
> 
> I admit I have to poor C++ knowledge to fix this possibly very simple
> issue.  Any help would be welcome.
> 
> Kind regards
> 
>       Andreas.
> 
> On Fri, Jan 27, 2017 at 01:23:40PM -0500, Aaron M. Ucko wrote:
>> Source: baitfisher
>> Version: 1.0+dfsg-1
>> Severity: important
>> Justification: fails to build from source
>>
>> Builds of baitfisher for 32-bit architectures such as i386 have been
>> failing:
>>
>>   range_functions.h: In member function 'bool CRangeList::add(faststring)':
>>   range_functions.h:596:31: error: invalid initialization of non-const reference of type 'faststring::size_t& {aka long unsigned int&}' from an rvalue of type 'faststring::size_t {aka long unsigned int}'
>>
>> The issue appears to be that, for some reason, class faststring has
>> (https://anonscm.debian.org/cgit/debian-med/baitfisher.git/tree/faststring2.h#n128)
>>
>>   // Shadow the "global" size_t typedef for this class.
>>     typedef unsigned long size_t;

I think you should ask upstream why they have this horrific typedef
instead of defining their own size type or using the normal size_t.

Maybe ask them why they decided to reimplement std::string as well...

>> but CRangeList::add uses the global size_t typedef, which is formally
>> unsigned int on 32-bit systems:
>>
>> https://anonscm.debian.org/cgit/debian-med/baitfisher.git/tree/range_functions.h#n591
>>
>>     size_t pos1=0, pos2, len=str.size();
>>
>> Although the two types are de facto equivalent on 32-bit
>> architectures, C++ compilers insist on treating them as different.
>> (This problem doesn't occur on 64-bit architectures, on which both
>> size_t typedefs are unsigned long.)
>>
>> Could you please take a look?

You need to make sure you use faststring's version of size_t. As a
workaround, I think this will work instead of the line above (untested):

  faststring::size_t pos1=0, pos2, len=str.size();

It's likely there will be other cases of this though.

James

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-med-packaging/attachments/20171211/bc734e49/attachment.sig>


More information about the Debian-med-packaging mailing list