Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: longdouble with elsize 12 is never uint alignable #12611

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

Merged
merged 5 commits into from
Dec 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trigger:
- master
- maintenance/*
jobs:
- job: Linux_Python_36_32bit_full
- job: Linux_Python_36_32bit_full_with_asserts
pool:
vmIMage: 'ubuntu-16.04'
steps:
Expand All @@ -26,7 +26,8 @@ jobs:
cp ./usr/local/include/* /usr/include && \
cd ../numpy && \
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1 \
F77=gfortran-5 F90=gfortran-5 python3 runtests.py --mode=full -- -rsx --junitxml=junit/test-results.xml"
F77=gfortran-5 F90=gfortran-5 \
CFLAGS=-UNDEBUG python3 runtests.py --mode=full -- -rsx --junitxml=junit/test-results.xml"
displayName: 'Run 32-bit Ubuntu Docker Build / Tests'
- task: PublishTestResults@2
inputs:
Expand Down
6 changes: 5 additions & 1 deletion numpy/core/src/common/array_assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ raw_array_is_aligned(int ndim, npy_intp *shape,

return npy_is_aligned((void *)align_check, alignment);
}
else {
else if (alignment == 1) {
return 1;
}
else {
/* always return false for alignment == 0, which means cannot-be-aligned */
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is alignment == 0 even a legal argument to this function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there is a better way to organize it... but the idea is that npy_uint_alignment, which normally returns the uint alignment, returns 0 if the type is not uint-alignable.

Then, it turned out to be convenient to allow the result of npy_uint_alignment to be passed directly to raw_array_is_aligned.

An alternative would be to check the return value of npy_uint_alignment explicitly everywhere it is used. But since it is pretty much always used as an arg to raw_array_is_aligned it seemed less complicated this way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

}
}

NPY_NO_EXPORT int
Expand Down
6 changes: 4 additions & 2 deletions numpy/core/src/common/array_assign.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ broadcast_strides(int ndim, npy_intp *shape,

/*
* Checks whether a data pointer + set of strides refers to a raw
* array whose elements are all aligned to a given alignment.
* alignment should be a power of two.
* array whose elements are all aligned to a given alignment. Returns
* 1 if data is aligned to alignment or 0 if not.
* alignment should be a power of two, or may be the sentinel value 0 to mean
* cannot-be-aligned, in which case 0 (false) is always returned.
*/
NPY_NO_EXPORT int
raw_array_is_aligned(int ndim, npy_intp *shape,
Expand Down