Is the co-pilot itself performance-sensitive?
Is the co-pilot itself performance-sensitive?
Posted Sep 22, 2024 22:45 UTC (Sun) by NYKevin (subscriber, #129325)In reply to: Is the co-pilot itself performance-sensitive? by NYKevin
Parent article: pcp: pmcd network daemon review (SUSE Security Team Blog)
> For those less familiar with C's arcane UB rules: &foo[bar] expands to &*(foo + bar), and the standard explicitly specifies that &* cancels out and no dereference takes place. So we can't remove the whole comparison entirely - it is legal to construct a pointer exactly one past the end with an expression like that, and so the compiler is required to emit code which at least checks for such a pointer.
Side note: If the compiler can prove that the pointer can't be exactly one past the end (e.g. if it can prove that vindex is odd and the array is of even length, or vice-versa), then it may indeed omit the entire check, which I suspect is where problems might plausibly arise.
