aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-03-03 21:43:40 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-17 10:04:37 +0100
commitf8f27931b9b1118363b364b04fb09526c62d21fb (patch)
tree230af8b688b94840ace13f01d7f371d237ddeb60 /validation
parentd9e64b95ca178336c0d63b0003b660f42289413c (diff)
downloadsparse-dev-f8f27931b9b1118363b364b04fb09526c62d21fb.tar.gz
llvm: fix pointer/float mixup in comparisons
In output_op_compare() everything that is not of interger type is treated as floats. Pointers disagree. Fix this by rearranging the code and treat pointers like integers as required for LLVM's icmp. Reported-by: Dibyendu Majumdar <mobile@majumdar.org.uk> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/backend/pointer-cmp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/validation/backend/pointer-cmp.c b/validation/backend/pointer-cmp.c
new file mode 100644
index 00000000..fa76d1b5
--- /dev/null
+++ b/validation/backend/pointer-cmp.c
@@ -0,0 +1,9 @@
+int cmpint( int x, int y) { return x == y; }
+int cmpflt( float x, float y) { return x == y; }
+int cmpvptr(void *x, void *y) { return x == y; }
+int cmpiptr(int *x, int *y) { return x == y; }
+
+/*
+ * check-name: pointer comparison
+ * check-command: ./sparsec -Wno-decl -c $file -o tmp.o
+ */