Bug 1410162

Summary: perl-PDL-2.17.0-1.fc26 FTBFS: tests segfaut on 64-bit PowerPC
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: perl-PDLAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jplesnik, perl-devel
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64   
OS: Unspecified   
URL: https://apps.fedoraproject.org/koschei/package/perl-PDL?collection=f26
Whiteboard:
Fixed In Version: perl-PDL-2.17.0-2.fc26 perl-PDL-2.16.0-2.fc25 perl-PDL-2.16.0-2.fc24 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-16 19:50:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Pisar 2017-01-04 16:09:11 UTC
perl-PDL-2.17.0-1.fc26 fails to build in F26 on ppc64 and ppc64le because some tests segfault:

t/bad.t ......................... 
Failed 47/82 subtests 
Badvalue is set to 0 or 1. This will cause data loss when using badvalues for comparison operators. at t/badvalue_scalar_cmp.t line 36.
	main::__ANON__() called at /usr/share/perl5/vendor_perl/Test/Builder.pm line 309
	eval {...} called at /usr/share/perl5/vendor_perl/Test/Builder.pm line 309
	Test::Builder::subtest(Test::Builder=HASH(0x10012666a38), "Issue example code", CODE(0x100126402f8)) called at /usr/share/perl5/vendor_perl/Test/More.pm line 807
	Test::More::subtest("Issue example code", CODE(0x100126402f8)) called at t/badvalue_scalar_cmp.t line 39
Badvalue is set to 0 or 1. This will cause data loss when using badvalues for comparison operators. at t/badvalue_scalar_cmp.t line 37.
	main::__ANON__() called at /usr/share/perl5/vendor_perl/Test/Builder.pm line 309
	eval {...} called at /usr/share/perl5/vendor_perl/Test/Builder.pm line 309
	Test::Builder::subtest(Test::Builder=HASH(0x10012666a38), "Issue example code", CODE(0x100126402f8)) called at /usr/share/perl5/vendor_perl/Test/More.pm line 807
	Test::More::subtest("Issue example code", CODE(0x100126402f8)) called at t/badvalue_scalar_cmp.t line 39
Badvalue is set to 0 or 1. This will cause data loss when using badvalues for comparison operators. at t/badvalue_scalar_cmp.t line 38.
	main::__ANON__() called at /usr/share/perl5/vendor_perl/Test/Builder.pm line 309
	eval {...} called at /usr/share/perl5/vendor_perl/Test/Builder.pm line 309
	Test::Builder::subtest(Test::Builder=HASH(0x10012666a38), "Issue example code", CODE(0x100126402f8)) called at /usr/share/perl5/vendor_perl/Test/More.pm line 807
	Test::More::subtest("Issue example code", CODE(0x100126402f8)) called at t/badvalue_scalar_cmp.t line 39
t/badvalue_scalar_cmp.t ......... ok
[...]
Test Summary Report
-------------------
t/bad.t                       (Wstat: 139 Tests: 35 Failed: 0)
  Non-zero wait status: 139
  Parse errors: Bad plan.  You planned 82 tests but ran 35.
t/gsl_interp.t                (Wstat: 139 Tests: 0 Failed: 0)
  Non-zero wait status: 139
  Parse errors: Bad plan.  You planned 12 tests but ran 0.
t/gsl_sf.t                    (Wstat: 139 Tests: 1 Failed: 0)
  Non-zero wait status: 139
  Parse errors: Bad plan.  You planned 3 tests but ran 1.
t/image2d.t                   (Wstat: 139 Tests: 8 Failed: 0)
  Non-zero wait status: 139
  Parse errors: Bad plan.  You planned 29 tests but ran 8.

Koschei reports first failure when ppc64 platform was added into Koji build system.

Comment 1 Petr Pisar 2017-01-05 10:46:43 UTC
The t/bad.t crashes after finishing test #47:

ok 40 - setbadif/stats test 5
ok 41 - setbadif/stats test 6
ok 42 - setbadtoval() worked
ok 43 -    and inplace
ok 44 - isbad() worked
ok 45 -   and inplace
ok 46 - badflag cleared using inplace setbadtoval()
a,b == 0,0
a,b == 1,1

[
 [  0   1]
 [BAD   3]
 [  4 BAD]
]
 [1 3 BAD]
ok 47 - badflag propagated using inplace copybad()
Segmentation fault

Comment 2 Petr Pisar 2017-01-05 11:39:52 UTC
The crashing test can be reduced to:

perl -Iblib/{lib,arch} -e 'use PDL; $a = pdl( qw(1 2 3 2) ); $ix = qsorti( $a );'

The crash depends on count and values of the pdl() argument.

Comment 3 Petr Pisar 2017-01-05 12:11:03 UTC
Back trace:

(gdb) bt
#0  0x00003fffb6f7896c in 00000017.plt_call.pdl_qsort_ind_D ()
   from blib/arch/auto/PDL/Ufunc/Ufunc.so
#1  0x00003fffb7006b28 in pdl_qsort_ind_D (xx=0x10057810, ix=0x10053dd0, a=0, 
    b=3) at Ufunc.xs:20172
#2  0x00003fffb7059f84 in pdl_qsorti_readdata (__tr=0x10049000)
    at Ufunc.xs:30447
#3  0x00003fffb76b4f68 in pdl__ensure_trans (trans=0x10049000, what=4)
    at pdlapi.c:1227
#4  0x00003fffb76b3720 in pdl_make_trans_mutual (trans=0x10049000)
    at pdlapi.c:849
#5  0x00003fffb70c0084 in XS_PDL_qsorti (my_perl=0x10030010, cv=0x108240b8)
    at Ufunc.xs:43278
#6  0x00003fffb7e17c04 in Perl_pp_entersub (my_perl=0x10030010)
    at pp_hot.c:3987
#7  0x00003fffb7e0e840 in Perl_runops_standard (my_perl=0x10030010) at run.c:41
#8  0x00003fffb7d832d8 in S_run_body (oldscope=<optimized out>, 
    my_perl=<optimized out>) at perl.c:2483
#9  perl_run (my_perl=0x10030010) at perl.c:2406
#10 0x0000000010000dd8 in main (argc=<optimized out>, argv=<optimized out>, 
    env=<optimized out>) at perlmain.c:116

#0  0x00003fffb6f7896c in 00000017.plt_call.pdl_qsort_ind_D () from blib/arch/auto/PDL/Ufunc/Ufunc.so
No symbol table info available.
#1  0x00003fffb7006b28 in pdl_qsort_ind_D (xx=0x10057810, ix=0x10053dd0, a=0, b=3) at Ufunc.xs:20172
        i = 2
        j = 1
        t = 1
        median = 2
#2  0x00003fffb7059f84 in pdl_qsorti_readdata (__tr=0x10049000) at Ufunc.xs:30447
        __inc_indx_n = 1
        nn = 3
        __tind1 = 0
        __tdims1 = 1
        __tinc0_0 = 0
        __tind2 = 0
        __tnpdls = 4
        __tinc0_1 = 0
        __tinc1_0 = 0
        __tdims0 = 1
        __offsp = 0x10cbf0e0
        __tinc1_1 = 0
        a_badval = -1.7976931348623157e+308
        indx_datap = 0x10053dd0
        indx_physdatap = 0x10053dd0
        indx_anyval_badval = {type = PDL_IND, value = {B = 128 '\200', S = -32768, U = 32768, L = -2147483648, N = -9223372036854775808, Q = -9223372036854775808, F = -0, D = -0}}
        a_datap = 0x10057810
        a_physdatap = 0x10057810
        a_anyval_badval = {type = PDL_D, value = {B = 255 '\377', S = -17, U = 65519, L = -1048577, N = -4503599627370497, Q = -4503599627370497, F = -nan(0x6fffff), 
            D = -1.7976931348623157e+308}}
        indx_badval = -9223372036854775808
        __n_size = 4
        __privtrans = 0x10049000
#3  0x00003fffb76b4f68 in pdl__ensure_trans (trans=0x10049000, what=4) at pdlapi.c:1227
        j = 2
        flag = 4
        par_pvaf = 0
#4  0x00003fffb76b3720 in pdl_make_trans_mutual (trans=0x10049000) at pdlapi.c:849
        wd = 0x10057840
        i = 2
        fflag = 0
        cfflag = 0
        pfflag = 0
#5  0x00003fffb70c0084 in XS_PDL_qsorti (my_perl=0x10030010, cv=0x108240b8) at Ufunc.xs:43278
        __privtrans = 0x10049000
        badflag_cache = 0
        bless_stash = 0x100502b0
        parent = 0x100501c0
        indx_SV = 0x1004fab8
        a = 0x10875d00
        objname = 0x10049a20 "PDL"
        nreturn = 1
        indx = 0x100383a0
        sp = 0x10035ad0
        ax = 1
        mark = 0x10035ad0
        items = 1

Comment 4 Petr Pisar 2017-01-05 15:26:33 UTC
The t/bad.t failure depends on enabling GSL support. It fails only if enabled.

Comment 5 Petr Pisar 2017-01-05 15:51:25 UTC
And it looks like the same issue as in gsl.spec itself:

# disable FMA
%ifarch aarch64 ppc64 ppc64le s390 s390x
export CFLAGS="$RPM_OPT_FLAGS -ffp-contract=off"
%endif

Disabling add-and-multiply FPU optimizations helps on ppc64.

Comment 6 Fedora Update System 2017-01-06 07:44:08 UTC
perl-PDL-2.16.0-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-499e3ba8d4

Comment 7 Fedora Update System 2017-01-06 07:44:25 UTC
perl-PDL-2.16.0-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-75eb9845f8

Comment 8 Fedora Update System 2017-01-06 23:20:53 UTC
perl-PDL-2.16.0-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-499e3ba8d4

Comment 9 Fedora Update System 2017-01-07 01:18:56 UTC
perl-PDL-2.16.0-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-75eb9845f8

Comment 10 Fedora Update System 2017-01-16 19:50:42 UTC
perl-PDL-2.16.0-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-01-16 20:49:35 UTC
perl-PDL-2.16.0-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.