[PATCH] fix interaction of typeof with bitwise types

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

 



typeof(bitwise) should resolve to the same SYM_RESTRICT type node, not just
to a copy of its contents.  Similar problem exists for struct and union,
BTW, but that's a separate story.

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
 symbol.c                       |    6 ++++++
 validation/restricted-typeof.c |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
 create mode 100644 validation/restricted-typeof.c

diff --git a/symbol.c b/symbol.c
index 20a04f3..abdc734 100644
--- a/symbol.c
+++ b/symbol.c
@@ -408,6 +408,12 @@ struct symbol *examine_symbol_type(struct symbol * sym)
 				warning(base->pos, "typeof applied to bitfield type");
 			if (base->type == SYM_NODE)
 				base = base->ctype.base_type;
+			if (base->type == SYM_RESTRICT) {
+				sym->type = SYM_NODE;
+				sym->ctype.modifiers = 0;
+				sym->ctype.base_type = base;
+				return examine_node_type(sym);
+			}
 			*sym = *base;
 			break;
 		}
diff --git a/validation/restricted-typeof.c b/validation/restricted-typeof.c
new file mode 100644
index 0000000..be77af8
--- /dev/null
+++ b/validation/restricted-typeof.c
@@ -0,0 +1,4 @@
+typedef unsigned __attribute__((bitwise)) A;
+A x;
+__typeof__(x) y;
+A *p = &y;
-- 
1.5.0-rc2.GIT


-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux