Bug 1268828 - RFE: On 32 bit platforms, enable -Duse64bitint and maybe also -Duselongdouble
RFE: On 32 bit platforms, enable -Duse64bitint and maybe also -Duselongdouble
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: perl (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jitka Plesnikova
Fedora Extras Quality Assurance
: FutureFeature, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-05 08:04 EDT by Richard W.M. Jones
Modified: 2017-06-06 08:50 EDT (History)
11 users (show)

See Also:
Fixed In Version: perl-5.26.0-392.fc27
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-06-06 08:50:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2015-10-05 08:04:43 EDT
Description of problem:

Perl on Fedora 32 bit platforms uses 32 bit ints, and on 64 bit
platforms uses 64 bit ints.

This causes some problems when we express size-in-bytes in some
programs -- it is easy for these kind of programs to work fine on
the common 64 bit platform, but to fail to work in bad ways (rounding
errors or overflows) on 32 bit.  Since 32 bit is comparatively rare,
these bugs can go unnoticed.  An example of a program that will fail
like this is: http://git.annexia.org/?p=import-to-ovirt.git;a=tree

Also, Debian (since Wheezy) has enabled this option, so by making
this change we would be consistent with Debian & Ubuntu.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=310995

Some pros and cons described here:

  http://www.nntp.perl.org/group/perl.perl5.porters/2010/04/msg158984.html

There is also interaction with another option (-Duselongdouble).

Version-Release number of selected component (if applicable):

perl-5.22.0-350.fc24
Comment 1 Richard W.M. Jones 2015-10-05 08:06:01 EDT
Of course this is an ABI break, so could only be done when we
are doing a Perl mass rebuild.
Comment 2 Petr Pisar 2015-10-05 08:31:26 EDT
I don't know what your script does. It probably bails out when you pushes a large file size into @virtual_sizes.

I have no problem with enabling use64bitint when upgrading to next perl 5.24 in Fedora 25. (Although I'm not aware that i686 has SISD instructions for 64-bit arithmetics. Isn't there a performance penalty with loading and storing integers compounding of two registers?)

I do not want to enable uselongdouble. It has many issues and is often broken.

We will have to do some benchmarks.

For the mean time, you can use Big::Int or bigint, for occasional math.
Comment 3 Richard W.M. Jones 2015-10-05 08:44:57 EDT
I meant to add a link to the discussion on devel list.  You
may not have seen it because it had a subject line that was
nothing to do with Perl.

https://lists.fedoraproject.org/pipermail/devel/2015-October/thread.html#215324

Another program we used to have that was broken on 32 bit Perl was:

https://github.com/libguestfs/libguestfs/blob/stable-1.8/tools/virt-resize#L33

This program does a bunch of calculations involving partition sizes
in bytes, and float is no use because the calculations don't work
if the least significant bits get truncated.

I eventually rewrote it in a different programming language to get
around this.
Comment 5 Petr Pisar 2016-06-13 03:41:19 EDT
perl-5.24.0 is built with 64-bit integers everywhere. Floats are still 32-bit on 32-bit platforms due to unresolved issues listed in the previous comment.
Comment 6 Petr Pisar 2016-12-05 04:50:20 EST
This feature is not enabled as tested with perl-5.24.0-379.fc25.i686:

# rpm -q perl
perl-5.24.0-379.fc25.i686
[root@ibm-x3650m4-01-vm-06 ~]# perl -V |grep use64bitint
    config_args='-des -Doptimize=none -Dccflags=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -Dldflags=-Wl,-z,relro  -Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro  -Dlddlflags=-shared -Wl,-z,relro  -Dshrpdir=/usr/lib -DDEBUGGING=-g -Dversion=5.24.0 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib/perl5 -Dvendorarch=/usr/lib/perl5/vendor_perl -Darchname=i386-linux-thread-multi -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize -Duse64bitint1'
    use64bitint=undef, use64bitall=undef, uselongdouble=undef

This is because of a typo in the spec file. The "-Duse64bitint1" should be "-Duse64bitint".
Comment 7 Jason Tibbitts 2017-05-31 13:58:07 EDT
As far as I can tell, this is still an issue with current rawhide.  At least the spec still has the stray '1'.

Is there any hope of fixing this in F26?  I have something that's blocked on 32-bit machines because of lack of unpack("Q>").  I've asked upstream to change their code to not use the quad types in unpack but I'm not sure that they will, and while I've read that there are workarounds I'm not sufficiently well-versed in Perl to try to implement them.
Comment 8 Richard W.M. Jones 2017-05-31 14:34:35 EDT
(In reply to Jason Tibbitts from comment #7)
> As far as I can tell, this is still an issue with current rawhide.  At least
> the spec still has the stray '1'.
> 
> Is there any hope of fixing this in F26?  I have something that's blocked on
> 32-bit machines because of lack of unpack("Q>").  I've asked upstream to
> change their code to not use the quad types in unpack but I'm not sure that
> they will, and while I've read that there are workarounds I'm not
> sufficiently well-versed in Perl to try to implement them.

Enabling the feature requires a mass rebuild (at least of Perl
packages), so it seems unlikely it can be enabled for F26 at
this point.  Later Fedora is still worthwhile though.
Comment 9 Petr Pisar 2017-06-01 03:49:43 EDT
This will be fixed in F27 only. The features changes ABI.
Comment 10 Jitka Plesnikova 2017-06-06 08:50:36 EDT
perl-5.26.0 is built with 64-bit integers everywhere. Floats are still 32-bit on 32-bit platforms.

Note You need to log in before you can comment on or make changes to this bug.