Skip to content

MAINT: fix new compiler warnings on clang#16857

Merged
mattip merged 1 commit intonumpy:masterfrom
mattip:fix-16605
Jul 14, 2020
Merged

MAINT: fix new compiler warnings on clang#16857
mattip merged 1 commit intonumpy:masterfrom
mattip:fix-16605

Conversation

@mattip
Copy link
Member

@mattip mattip commented Jul 14, 2020

gh-16605 passed local CI but after merge CI is broken. Maybe an interaction with some other branch that was merged after it was last run through CI

@mattip mattip added 03 - Maintenance component: build component: SIMD Issues in SIMD (fast instruction sets) code or machinery labels Jul 14, 2020
@mattip mattip merged commit 0c1301f into numpy:master Jul 14, 2020
@mattip
Copy link
Member Author

mattip commented Jul 14, 2020

I am going to self-merge to clear the build failures.

(abs(steps[2]) < MAX_STEP_SIZE) && \
((labs(steps[0]) < MAX_STEP_SIZE) && \
(labs(steps[1]) < MAX_STEP_SIZE) && \
(labs(steps[2]) < MAX_STEP_SIZE) && \
Copy link
Member

Choose a reason for hiding this comment

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

Was good to merge, question though, doesn't this have to be llabs on 64bit windows?

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe?

Copy link
Member

Choose a reason for hiding this comment

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

I would think steps is intp here, which may be a long long on windos 64. Its a corner case, but I expect we should change that. Or just use a macro x < 0 ? -x : x compilers probably make that a single instruction anyway?

Copy link
Member

@eric-wieser eric-wieser Jul 14, 2020

Choose a reason for hiding this comment

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

I'm with @seberg, this isn't a complete fix for platforms where long != long long (but is for other platforms)

Another option would be to use the C99 syntax,

#define np_abs(x) _Generic((x), int: abs, long: labs, long long: llabs, intmax_t: imaxabs)(x)

Copy link
Member

@seberg seberg Jul 17, 2020

Choose a reason for hiding this comment

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

I am wondering if we should just write it as steps[0] < MAX_STEP_SIZE && -MAX_STEP_SIZE < steps[0]?

Is the nomemoverlap call incorrect, in that it needs to use steps[0] * (dimensions[0]-1), although, I suppose that does not matter, it is very unlikely to misfire. It may be that if it misfires, it will also always be fine. But, I am not quite sure it is right now, because I suppose overflows could happen inside nomemoverlap.

EDIT: Hmmm, this all only works if we assume identical item/element sizes, right? Which I guess should generally be fine

@mattip mattip deleted the fix-16605 branch January 25, 2022 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

03 - Maintenance component: build component: SIMD Issues in SIMD (fast instruction sets) code or machinery

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants