> The GOT is an array of addresses, and [EMAIL PROTECTED] addresses one of these
> addresses.  Thus [EMAIL PROTECTED] points to the address of a different and
> unrelated variable, assuming it is still within the range of the GOT.

You must have a 32 bit machine on your desk ;-)

On a 64 bit BE machine (like s390), [EMAIL PROTECTED] points to the LSB subreg
of the address, such as when casting the address to a 32-bit int.
This is what __builtin_strlen() ends up doing in my test case.

The s390 has an opcode that does essentially "strchr()".  Strlen is
implemented by calling this opcode, and subtracting pointers.  If the
result is cast to an int and compared to zero, the optimizer replaces
all that with a compare of the lower subreg of the two addresses.

Reply via email to