This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: empty slices: defined?
> Yes, but if __gs._M_index is null, we cannot get to
> __gs._M_index->_M_index (even if only its address is taken) used by
We don't have to dereference it to know its address. It's 0x18 on my
system, which is the value passed. Essentially, gcc is computing
(__gs._M_index + OffsetOf(_M_index)), which requires no dereferencing.
> the expression template _GClos<> later, so my question is what will be
> computing? If one passes a null pointer to _GClos<>, what will it do
> with it?
It dereferences the nearly-null pointer and crashes. It's only a
handful of opcodes after the function call, so it was easy to debug.