Skip to content

Inconsistent results from pointer comparison #8161

Open
@Anthonysdu

Description

@Anthonysdu
#include <assert.h>
extern int nondet_int();
int main() {
  int m = nondet_int();
  int *n = &m;
  
  if((unsigned long)n >= (unsigned long)(-4095))
    assert((unsigned int)(-1 * (long)n) < 6);
    
  int a = -2048;
  if((unsigned long)a >= (unsigned long)(-4095))
    assert((unsigned int)(-1 * (long)a) < 6);
}
** Results:
main.c function main
[main.assertion.1] line 8 assertion (unsigned int)(-1 * (long)n) < 6: SUCCESS
[main.assertion.2] line 12 assertion (unsigned int)(-1 * (long)a) < 6: FAILURE

** 1 of 2 failed (2 iterations)

Hi, is there a problem here in the first assertion? it should fail if n = -2048.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions