8000 masked array autotest fails with bus error (Trac #1094) · Issue #1692 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

masked array autotest fails with bus error (Trac #1094) #1692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thouis opened this issue Oct 19, 2012 · 4 comments
Closed

masked array autotest fails with bus error (Trac #1094) #1692

thouis opened this issue Oct 19, 2012 · 4 comments
Labels
00 - Bug component: numpy.ma masked arrays Priority: high High priority, also add milestones for urgent issues
Milestone

Comments

@thouis
Copy link
Contributor
thouis commented Oct 19, 2012

Original ticket http://projects.scipy.org/numpy/ticket/1094 on 2009-04-24 by trac user Gerard, assigned to @charris.

Running the numpy (version 1.3.0, but also occurs on 1.2.1) autotester fails on masked array test case with a bus error. Used system is Solaris 5.8:
uname -a
SunOS wsasd529 5.8 Generic_117350-18 sun4u sparc SUNW,Sun-Blade-1500

output of "numpy.test(verbose=10)":

...
Tests how masks are initialized at the creation of Maskedarrays. ... ok
Check the use of ndmin ... ok
Make sure we're not losing the original mask w/ ndmin ... ok
Tests creaating a masked array from alist of masked arrays. ... ok
test_deepcopy (test_core.TestMaskedArray) ... ok
Test printing a masked array w/ fancy dtype. ... ok
Test filled w/ flexible dtype ... Bus error

Bus error is caused by a misaligned memory write (see output of purify below):

MAW: Misaligned memory write
  This is occurring while in:
        DOUBLE_fastputmask [arraytypes.inc.src:2282]
                   s_val = *vals;
                   for (i = 0; i < ni; i++) {
                       if (mask[i]) {
        =>                 in[i] = s_val;
                       }
                   }
               }
        PyArray_PutMask [multiarraymodule.c:4687]
                       }
                   }
                   else {
        =>             func(dest, mask->data, ni, values->data, nv);
                   }
               }

        array_putmask  [multiarraymodule.c:4600]
                                                &array, &mask, &values)) {
                   return NULL;
               }
        =>     return PyArray_PutMask((PyArrayObject *)array, values, mask);
           }

           /*NUMPY_API
        PyCFunction_Call [methodobject.c:77]
        PyEval_EvalFrameEx [ceval.c:3564]
        PyEval_EvalFrameEx [ceval.c:3650]
        PyEval_EvalCodeEx [ceval.c:2831]
        PyEval_EvalFrameEx [ceval.c:3659]
        ...

Commenting the execution of the fastputmask in multiarraymodule.c (and thus running the 'slower' version already implemented there) solves the problem:

multiarraymodule.c, line 4676 (and further):

    func = self->descr->f->fastputmask;
    /*if (func == NULL) {*/
        for (i = 0; i < ni; i++) {
            tmp = ((Bool *)(mask->data))[i];
            if (tmp) {
                src = values->data + chunk*(i % nv);
                memmove(dest + i*chunk, src, chunk);
            }
        }
    /*}
    else {
        func(dest, mask->data, ni, values->data, nv);
    }*/

added here are the comment blocks such that func is not executed anymore.

'Minimal' piece of python code to reproduce:

from numpy.ma.core import *

f = array([(1,1)], dtype=[('i',int),('f',float)])

f.mask = [1,1]

f.filled()

@thouis thouis closed this as completed Oct 19, 2012
@numpy-gitbot
Copy link

@charris wrote on 2009-04-24

This is probably related to #1630, which came about as an attempt to fix an earlier bus error, IIRC.

@numpy-gitbot
Copy link

@pierregm wrote on 2009-07-18

  • As this is not a numpy.ma problem but a multiarraymodule.c one, I kick the ball in touch.

@numpy-gitbot
Copy link

@mwiebe wrote on 2011-03-24

STSCI run the tests on Solaris, and report the tests are passing, so closing the issue.

@numpy-gitbot
Copy link

Milestone changed to 1.6.0 by @mwiebe on 2011-03-24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug component: numpy.ma masked arrays Priority: high High priority, also add milestones for urgent issues
Projects
None yet
Development

No branches or pull requests

2 participants
0