Powered by Linux
Address space of struct member — Semantic Matching Tool

Address space of struct member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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?


Andrew Murray

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux