Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce effective types for specified-width integer types #504

Open
btj opened this issue May 15, 2024 · 0 comments
Open

Enforce effective types for specified-width integer types #504

btj opened this issue May 15, 2024 · 0 comments

Comments

@btj
Copy link
Member

btj commented May 15, 2024

VeriFast accepts the following program, even though it exhibits undefined behavior per C's "effective types" rules:

#include <stdlib.h>
#include <stdint.h>

int main()
//@ requires true;
//@ ensures false;
{
  int i = 0;
  int *p = &i;
  int16_t *q = (void *)p;
  *p = 42;
  //@ open integer(p, 42);
  //@ open int_(p, some(42));
  //@ integer__to_chars(p, 4, true);
  //@ chars_to_integer_(q, 2, true);
  *q = 0; // This is Undefined Behavior. It can lead to miscompilation: https://godbolt.org/z/Yz6z1G6f5
  abort();
}

See #315 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant