You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like the body of the inner loop to be able to rely on the c it accesses matching the c before it, as well as the c in its own invariant. This was my first attempt:
#include <stdint.h>
void
foo(void)
{
for(int c = 0; c < 1; ++c)
/*@ inv 0i32 <= c; c <= 1i32;
@*/
{
int k = c;
for (int i = 0; i < 1; ++i)
/*@ inv 0i32 <= i; i <= 1i32;
0i32 <= c; c < 1i32;
{&k} unchanged;
{&c} unchanged;
@*/
{
/*@ assert(k==c);@*/
}
}
}
This works:
void
foo3(void)
{
for(int c = 0; c < 1; ++c)
/*@ inv 0i32 <= c; c <= 1i32;
@*/
{
int k = c;
for (int i = 0; i < 1; ++i)
/*@ inv 0i32 <= i; i <= 1i32;
0i32 <= c; c < 1i32; // NOTE this is not the same as the outer invariant!
k == c;
{&k} unchanged;
{&c} unchanged;
@*/
{
/*@ assert(k==c);@*/
}
/*@ assert(k==c);@*/
}
}
I think if the unchanged notation allowed {c} unchanged that would fix this.
I would like the body of the inner loop to be able to rely on the
c
it accesses matching thec
before it, as well as thec
in its own invariant. This was my first attempt:This works:
I think if the unchanged notation allowed
{c} unchanged
that would fix this.The text was updated successfully, but these errors were encountered: