Return-Path: Received: from foss.arm.com ([217.140.110.172]:47692 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728922AbfGHNLd (ORCPT ); Mon, 8 Jul 2019 09:11:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 227A52B for ; Mon, 8 Jul 2019 06:11:33 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 989FE3F738 for ; Mon, 8 Jul 2019 06:11:32 -0700 (PDT) Date: Mon, 8 Jul 2019 14:11:31 +0100 From: Andrew Murray Subject: Address space of struct member Message-ID: <20190708131130.GL7227@e119886-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: smatch-owner@vger.kernel.org List-ID: To: smatch@vger.kernel.org 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