This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does gcc conform to C++ ABI?
Daniel Jacobowitz <drow@false.org> writes:
> On Fri, Feb 13, 2009 at 12:00:38PM -0800, Ian Lance Taylor wrote:
>> > Another issue for scope encoding. C++ ABI:
>> >
>> > ---
>> > Occasionally entities in local scopes must be mangled too
>> > (e.g. because inlining or template compilation causes multiple
>> > translation units to require access to that entity).
>> > ---
>> >
>> > seems to imply that the local symbols may have external
>> > linkage. Am I wrong?
>>
>> You are wrong. When an inline function is expanded into multiple
>> translation units, and that inline function has a static variable, then
>> multiple translation units require access to the static variable. That
>> does not imply that the static variable has external linkage.
>
> Does this mean that if you compiled some of those TUs with GCC, and
> some with icc, they might legitimately access different copies of the
> static variable? Seems odd.
Hmmm, you're right, I didn't think of that case.
And, in fact, the ABI does discuss how this case should be handled, and
g++ appears to do it correctly. So I was misunderstanding the issue,
but I think we're still OK.
HJ, do you still see a problem here?
Ian