https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81172
--- Comment #2 from Xi Ruoyao <ryxi at stu dot xidian.edu.cn> --- (In reply to Andrew Pinski from comment #1) > The first one is well defined by C/C++. [expr.add] para 4: When an expression that has integral type is added to or subtracted from a pointer, the result has the type of the pointer operand. If the expression P points to element x[i] of an array object x with n elements, the expressions P + J and J + P (where J has the value j) point to the (possibly-hypothetical) element x[i + j] if 0 ≤ i + j ≤ n; otherwise, the behavior is undefined. Likewise, the expression P - J points to the (possibly-hypothetical) element x[i − j] if 0 ≤ i − j ≤ n; otherwise, the behavior is undefined.