https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92634

--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> No those are still officially considered a referencing. 
> 
> In fact all three cases:
> &p->field does not dereference p, just as &*p and &p[i] do not.
> 
> Should be considered a deference even though the deference does not happen.

The ISO C standard ISO/IEC 9899:1999 appears to disagree with you.

From 6.5.3.2
"3  The unary & operator returns the address of its operand. If the operand has
type ‘‘type’’, the result has type ‘‘pointer to type’’. If the operand is the
result of a unary * operator, neither that operator nor the & operator is
evaluated and the result is as if both were omitted, except that the
constraints on the operators still apply and the result is not an lvalue.
Similarly, if the operand is the result of a [] operator" [snip rest]

I do not see anything under "constraints on the operators" that precludes &*p
on a null p, in fact there is a note that says

"83) Thus, &*E is equivalent to E (even if E is a null pointer)" [snip rest]

So what is more official than the C standard that makes you say "those are
still officially considered a referencing"?

Reply via email to