> > This one example of gcc making assumptions about pointer arithmetic. It's > > perfectly reasonable. It's also unhelpful cases like for per-cpu offsets. > > What assumption does GCC make that would cause problems? The C standard says that arithmetic on pointers in defined objects outside the boundaries of these objects (except for the special case of one beyond the end for arrays) is undefined. The gcc optimizers take advantage of this by assuming that such arithmetic doesn't wrap (and might have other assumptions) > > > Thus we use this macro to prevent GCC from making such assumptions. > > Never seen any ill effect from just using a pointer recast and add. One concrete miscompilation has been observed on PPC a couple of years ago, so it was decided to try to avoid this on all architectures. > > One issue may be that issue of pointer into an object not being valid if > they are made to point outside of the object? "undefined" yes. -Andi -- ak@xxxxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-next" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html