[patch][pr22217] Use the most recent decl for mangling

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jan 21 13:52:31 PST 2015


On 21 January 2015 at 16:30, Richard Smith <richard at metafoo.co.uk> wrote:
> On Tue, Jan 20, 2015 at 9:42 AM, David Majnemer
> <david.majnemer at gmail.com> wrote:
>> I don't think this approach would handle things like:
>>
>> int pr22217_foo;
>> int *b = &pr22217_foo;
>> extern int pr22217_foo __asm__("pr22217_bar");
>
> I think we should either reject this code, or ignore the __asm__ with
> a warning. __asm__ is effectively an attribute, and we don't support
> adding attributes after we've seen the definition of an entity, for
> exactly this reason. For instance:

In here int is a tentative definition (C code).

It was also first noticed when building glibc, so it is both support
by gcc and used in at least one location.

I can add an error/warning for now. To be clear, you want to error/warn on

int pr22217_foo;
extern int pr22217_foo __asm__("pr22217_bar");

Even when pr22217_foo is not used in between the two lines?

Cheers,
Rafael



More information about the cfe-commits mailing list