diff --git a/src/plugins/wp/tests/wp_plugin/oracle/overflow2.res.oracle b/src/plugins/wp/tests/wp_plugin/oracle/overflow2.res.oracle index bbd22a05eecf6aa5418f9b8a856d537ebc53f9b9..b0e1722d9dc81cfbda055c5e99e3d235dad9eda0 100644 --- a/src/plugins/wp/tests/wp_plugin/oracle/overflow2.res.oracle +++ b/src/plugins/wp/tests/wp_plugin/oracle/overflow2.res.oracle @@ -11,22 +11,22 @@ Prove: true. ------------------------------------------------------------ -Goal Assertion 'a01' (file tests/wp_plugin/overflow2.c, line 20): +Goal Assertion 'a01' (file tests/wp_plugin/overflow2.c, line 27): Prove: true. ------------------------------------------------------------ -Goal Assertion 'a02' (file tests/wp_plugin/overflow2.c, line 21): +Goal Assertion 'a02' (file tests/wp_plugin/overflow2.c, line 28): Prove: true. ------------------------------------------------------------ -Goal Assertion 'a03' (file tests/wp_plugin/overflow2.c, line 22): +Goal Assertion 'a03' (file tests/wp_plugin/overflow2.c, line 29): Prove: true. ------------------------------------------------------------ -Goal Assertion 'a04' (file tests/wp_plugin/overflow2.c, line 23): +Goal Assertion 'a04' (file tests/wp_plugin/overflow2.c, line 30): Assume { Type: is_sint16(distance_0) /\ is_uint32(p1_off_0). (* Pre-condition *) @@ -36,7 +36,7 @@ Prove: (p1_off_0 + to_uint16(distance_0)) <= 65545. ------------------------------------------------------------ -Goal Assertion 'a05' (file tests/wp_plugin/overflow2.c, line 24): +Goal Assertion 'a05' (file tests/wp_plugin/overflow2.c, line 31): Let x = p1_off_0 + to_uint16(distance_0). Assume { Type: is_sint16(distance_0) /\ is_uint32(p1_off_0). @@ -49,7 +49,7 @@ Prove: x = to_uint32(x). ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/overflow2.c, line 14) in 'pointers_and_companions': +Goal Assigns (file tests/wp_plugin/overflow2.c, line 21) in 'pointers_and_companions': Prove: true. ------------------------------------------------------------ @@ -62,55 +62,45 @@ Prove: true. ------------------------------------------------------------ -Goal Assertion 'a06' (file tests/wp_plugin/overflow2.c, line 39): -Let x = p1_off_alt_0 + to_uint16(distance_0). -Assume { - Type: is_sint16(distance_0) /\ is_uint64(p1_off_alt_0). - (* Pre-condition *) - Have: p1_off_alt_0 <= 10. -} -Prove: to_uint64(x) = to_uint32(x). +Goal Assertion 'a06' (file tests/wp_plugin/overflow2.c, line 46): +Prove: true. ------------------------------------------------------------ -Goal Assertion 'a07' (file tests/wp_plugin/overflow2.c, line 40): +Goal Assertion 'a07' (file tests/wp_plugin/overflow2.c, line 47): Prove: true. ------------------------------------------------------------ -Goal Assertion 'a08' (file tests/wp_plugin/overflow2.c, line 41): +Goal Assertion 'a08' (file tests/wp_plugin/overflow2.c, line 48): Prove: true. ------------------------------------------------------------ -Goal Assertion 'a09' (file tests/wp_plugin/overflow2.c, line 42): -Let x = p1_off_alt_0 + to_uint16(distance_0). +Goal Assertion 'a09' (file tests/wp_plugin/overflow2.c, line 49): Assume { - Type: is_sint16(distance_0) /\ is_uint64(p1_off_alt_0). + Type: is_sint16(distance_0) /\ is_uint32(p1_off_alt_0). (* Pre-condition *) Have: p1_off_alt_0 <= 10. - Have: to_uint64(x) = to_uint32(x). } -Prove: x <= 65545. +Prove: (p1_off_alt_0 + to_uint16(distance_0)) <= 65545. ------------------------------------------------------------ -Goal Assertion 'a10' (file tests/wp_plugin/overflow2.c, line 43): +Goal Assertion 'a10' (file tests/wp_plugin/overflow2.c, line 50): Let x = p1_off_alt_0 + to_uint16(distance_0). -Let x_1 = to_uint32(x). Assume { - Type: is_sint16(distance_0) /\ is_uint64(p1_off_alt_0). + Type: is_sint16(distance_0) /\ is_uint32(p1_off_alt_0). (* Pre-condition *) Have: p1_off_alt_0 <= 10. - Have: to_uint64(x) = x_1. (* Assertion 'a09' *) Have: x <= 65545. } -Prove: x = x_1. +Prove: x = to_uint32(x). ------------------------------------------------------------ -Goal Assigns (file tests/wp_plugin/overflow2.c, line 33) in 'pointers_and_companions_ulong': +Goal Assigns (file tests/wp_plugin/overflow2.c, line 40) in 'pointers_and_companions_ulong': Prove: true. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_plugin/overflow2.c b/src/plugins/wp/tests/wp_plugin/overflow2.c index f2a27e3b194a6c9b7d4b28557390cf44a082e05a..da847d4d3562491444bacd4a818ff35c4312eb34 100644 --- a/src/plugins/wp/tests/wp_plugin/overflow2.c +++ b/src/plugins/wp/tests/wp_plugin/overflow2.c @@ -1,3 +1,10 @@ +/* run.config + OPT: -machdep x86_32 +*/ +/* run.config_qualif + OPT: -machdep x86_32 +*/ + /* run with: frama-c-gui -wp -wp-rte strange_work_again.c */ // uproven: a04, a05, a09, a10 // note that when the type of distance is ushort, all is proven diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle index 2da8a61064543250389dc3d71a7ee5a41f1662bd..f6ac9a650aea8ed15b1ca16eb05f2209f1930beb 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_string.0.res.oracle @@ -7,31 +7,7 @@ ------------------------------------------------------------ Goal Post-condition (file tests/wp_typed/user_string.i, line 23) in 'strlen': -Let x = ss_0.offset. -Let x_1 = s.offset. -Let x_2 = x - x_1. -Let x_3 = s.base. -Assume { - (* Heap *) - Type: (region(x_3) <= 0) /\ linked(Malloc_0) /\ sconst(Mchar_0). - (* Pre-condition *) - Have: P_Length_of_str_is(Malloc_0, Mchar_0, s, i). - (* Pre-condition *) - Have: P_Length_of_str_is(Malloc_0, Mchar_0, s, i_1). - (* Invariant 'ZERO' *) - Have: forall i_2 : Z. ((0 <= i_2) -> (((i_2 + x_1) < x) -> - (Mchar_0[shift_sint8(s, i_2)] != 0))). - (* Invariant 'RANGE' *) - Have: addr_le(s, ss_0) /\ - addr_le(ss_0, shift_sint8(s, L_Length(Mchar_0, s))). - (* Invariant 'BASE' *) - Have: ss_0.base = x_3. - (* Else *) - Have: Mchar_0[ss_0] = 0. - (* Assertion 'END' *) - Have: P_Length_of_str_is(Malloc_0, Mchar_0, s, x_2). -} -Prove: P_Length_of_str_is(Malloc_0, Mchar_0, s, to_sint32(x_2)). +Prove: true. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle b/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle index ed81e6ce070279e157b8c7e08de506a7420dd0d8..b0256f00b0c4d77b72ad77ee1e2fd7ab3bb14df3 100644 --- a/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle +++ b/src/plugins/wp/tests/wp_typed/oracle/user_string.1.res.oracle @@ -7,31 +7,7 @@ ------------------------------------------------------------ Goal Post-condition (file tests/wp_typed/user_string.i, line 23) in 'strlen': -Let x = ss_0.offset. -Let x_1 = s.offset. -Let x_2 = x - x_1. -Let x_3 = s.base. -Assume { - (* Heap *) - Type: (region(x_3) <= 0) /\ linked(Malloc_0) /\ sconst(Mchar_0). - (* Pre-condition *) - Have: P_Length_of_str_is(Malloc_0, Mchar_0, s, i). - (* Pre-condition *) - Have: P_Length_of_str_is(Malloc_0, Mchar_0, s, i_1). - (* Invariant 'ZERO' *) - Have: forall i_2 : Z. ((0 <= i_2) -> (((i_2 + x_1) < x) -> - (Mchar_0[shift_sint8(s, i_2)] != 0))). - (* Invariant 'RANGE' *) - Have: addr_le(s, ss_0) /\ - addr_le(ss_0, shift_sint8(s, L_Length(Mchar_0, s))). - (* Invariant 'BASE' *) - Have: ss_0.base = x_3. - (* Else *) - Have: Mchar_0[ss_0] = 0. - (* Assertion 'END' *) - Have: P_Length_of_str_is(Malloc_0, Mchar_0, s, x_2). -} -Prove: P_Length_of_str_is(Malloc_0, Mchar_0, s, to_sint32(x_2)). +Prove: true. ------------------------------------------------------------ diff --git a/src/plugins/wp/tests/wp_typed/user_string.i b/src/plugins/wp/tests/wp_typed/user_string.i index ccadee77578d841643733fd8ebae1cc3bee7d6ce..228942a2a3778ab4f79800bcb2cca303f5504707 100644 --- a/src/plugins/wp/tests/wp_typed/user_string.i +++ b/src/plugins/wp/tests/wp_typed/user_string.i @@ -22,7 +22,7 @@ assigns \nothing; ensures \exists integer i; Length_of_str_is(s,i) && \result == i; @*/ -int strlen(const char *s) { +long long strlen(const char *s) { const char *ss = s; /*@ loop invariant BASE: \base_addr(s) == \base_addr(ss) ;