aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-08 03:26:40 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-10 23:26:23 +0100
commit2a6c80fdd0616e20d6227eb4ab51feb84ba57c4e (patch)
treed491424eeef6134b89295fcc2d2ca89ed9633181
parent391bd454457e496410f92b1c730a48b277f460e4 (diff)
downloadsparse-2a6c80fdd0616e20d6227eb4ab51feb84ba57c4e.tar.gz
add test for dereference cost of symbol with complex type
Currently, in expand_dereference(), the dereference of a symbol with a complex type is considered as costing as high as a non-symbol because it's not recognised it's a symbol. Add a testcase for this. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--validation/expand/cost-deref-nested.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/validation/expand/cost-deref-nested.c b/validation/expand/cost-deref-nested.c
new file mode 100644
index 00000000..b09602b6
--- /dev/null
+++ b/validation/expand/cost-deref-nested.c
@@ -0,0 +1,21 @@
+struct s {
+ struct {
+ int u, v;
+ } a, b;
+};
+
+static const struct s s;
+
+static int foo(int c)
+{
+ return c && s.b.v;
+}
+
+/*
+ * check-name: cost-deref-nested
+ * check-command: test-linearize -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: cbr
+ */