Address space of struct member
Andrew Murray <[email protected]>
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm trying to obtain the address space of a member struct variable, e.g.
Given the following test code:
struct astruct {
int __attribute__((address_space(5))) member1;
};
int main(void)
{
struct astruct thestruct;
int __attribute__((address_space(5))) local;
if (local > 1)
;
if (thestruct.member1 > 1)
;
return 0;
}
And the following smatch check:
static void check(struct expression *expr)
{
struct symbol *sym;
expr_to_var_sym(expr, &sym);
if (sym)
sm_warning("Address space %d\n", sym->ctype.as);
}
void check_as(int id)
{
add_hook(&check, SYM_HOOK);
}
When I run this check, it correctly picks up that 'local' has address
space 5 - however it incorrectly indicates that 'member1' has address
space 0.
Is there something that I am doing wrong? Or is this something I need
to fix?
Thanks,
Andrew Murray