This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: alias of structure members
Ãngel GonzÃlez <keisial@gmail.com> writes:
> On 12/02/12 06:41, Ian Lance Taylor wrote:
>>> This syntax works fine in gcc 3.4 but seems to have disappeared in gcc4,
>>> where it complains that the symbol is aliased to undefined symbol.
>> I don't see any evidence that this actually worked in gcc 3.4. In 3.4
>> it would make Localfoo an alias for a symbol named literally
>> "Foo.Foodata". it would not make Localfoo an alias for the Foodata
>> field of the global variable Foo. I think gcc4 is kindly giving you an
>> error for something that never actually worked.
>>
>> Ian
> That's odd. Even if the compiler didn't check it, I would have expected a
> linker error in such case.
> Although I only tried to compile it, not to actually use it, maybe some
> optimization was removing all the symbols altogether, making it look as
> if it worked. I'll check tomorrow and report back.
The linker tends to only complain if an undefined symbol is used. I
don't know if that explains what you are seeing, but perhaps it does.
Ian