aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-14 16:33:48 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-21 17:27:45 +0200
commitefda1a044c7ce014f38c3225ec79b2befd0a0620 (patch)
tree71bc3d37786bc19be035fc5ca5d7a3c66e711e37
parent80e2b2a0fc0f39e92873c8462ec795b991f84ca7 (diff)
downloadsparse-efda1a044c7ce014f38c3225ec79b2befd0a0620.tar.gz
misc: fix testcase typeof-safe
This testcase was marked as known-to-fail but it was simply the expected error messages that were missing. So, slightly reorganize the test a little bit, add the expected messages and remove the 'known-to-fail' tag. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--validation/typeof-safe.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/validation/typeof-safe.c b/validation/typeof-safe.c
index 614863fb..797c759f 100644
--- a/validation/typeof-safe.c
+++ b/validation/typeof-safe.c
@@ -2,22 +2,35 @@
static void test_safe(void)
{
- int __safe obj, *ptr;
- typeof(obj) var = obj;
- typeof(ptr) ptr2 = ptr;
+ int obj;
+ int __safe *ptr;
+
+ int __safe *ptr2 = ptr;
+ typeof(ptr) ptr3 = ptr;
typeof(*ptr) var2 = obj;
- typeof(*ptr) *ptr3 = ptr;
- typeof(obj) *ptr4 = ptr;
+ int __safe var3 = obj;
+ int *ptr4 = &obj;
+ int *ptr5 = ptr; // KO
+
+ typeof(*ptr) sobj;
+ typeof(&sobj) ptr6 = &obj;
+ typeof(&sobj) ptr7 = ptr; // KO
+
obj = obj;
ptr = ptr;
- ptr = &obj;
obj = *ptr;
+ ptr = (int __safe *) &obj;
}
/*
* check-name: typeof-safe
- * check-known-to-fail
*
* check-error-start
+typeof-safe.c:13:21: warning: incorrect type in initializer (different modifiers)
+typeof-safe.c:13:21: expected int *ptr5
+typeof-safe.c:13:21: got int [safe] *ptr
+typeof-safe.c:17:30: warning: incorrect type in initializer (different modifiers)
+typeof-safe.c:17:30: expected int *ptr7
+typeof-safe.c:17:30: got int [safe] *ptr
* check-error-end
*/