[PATCH] symbol: preserve address space qualifiers with typeof()

Dan Carpenter <[email protected]>
Newsgroups org.kernel.vger.linux-sparse
Message-ID <[email protected]>
When we're parsing typeof(var) we then preserve the address space
qualifiers as well.  Otherwise it leads to warnings like this:

"warning: cast removes address space '__seg_gs' of expression"

Reported-by: Uros Bizjak <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
---
 symbol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/symbol.c b/symbol.c
index 6a39e5487c17..301a6ed225d2 100644
--- a/symbol.c
+++ b/symbol.c
@@ -552,6 +552,7 @@ static struct symbol *examine_pointer_type(struct symbol *sym)
 static struct symbol *examine_typeof_helper(struct symbol *sym, bool qual)
 {
 	struct symbol *base = evaluate_expression(sym->initializer);
+	struct ident *as = base->ctype.as;
 	unsigned long mod = 0;
 
 	if (!base)
@@ -567,6 +568,8 @@ static struct symbol *examine_typeof_helper(struct symbol *sym, bool qual)
 	sym->type = SYM_NODE;
 	sym->ctype.modifiers = mod;
 	sym->ctype.base_type = base;
+	if (qual)
+		sym->ctype.as = as;
 	return examine_node_type(sym);
 }
 
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.