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

--- Comment #13 from Alan Modra <amodra at gmail dot com> ---
Yes, I came to the conclusion myself that this is really nothing to do with
dereferencing.  So my original claim and Andrew's replies about dereferencing
are not relevant.  The standard says of unary &

"The operand of the unary & operator shall be either a function designator, the
result of a [] or unary * operator, or an lvalue that designates an object that
is not a bit-field and is not declared with the register storage-class
specifier."

We don't have a function designator, the result of a [] or unary *, so the &
operand must be an lvalue.  Of lvalues, the standard says (in part):

"if an lvalue does not designate an object when it is evaluated, the behavior
is undefined"

And that along with lack of a special case for &p->f is the language reason why
the binutils code was UB.

Reply via email to