https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99068
Segher Boessenkool <segher at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> --- a) The code does not compile (it is not complete source code, some includes are needed); b) When you fix that, the compiler will tell you it is invalid code (you shadow "a" with an incompatible type). c) You do not say which target you used. So let's try this (on powerpc64-linux, -O3 since you want that, everything else default): === #include <stdint.h> int found_zero_ptr(int16_t *a, int N) { for (int16_t *p = a; p < a + N; p++) if (*p == 0) return 1; return 0; } === which as core has === .L21: lha 9,2(3) addi 3,3,4 cmpld 7,3,4 cmpwi 0,9,0 beq 0,.L5 bge 7,.L4 .L3: lha 9,0(3) cmpwi 0,9,0 bne 0,.L21 === You cannot use lha in this without making the generated code worse. (Marking this invalid *again*.)