[infer][PR] Don't join postconditions. Fixes #678.
Summary: Increases precision a bit. I didn't observe speed problems on what I tested. (But, who knows?) Closes https://github.com/facebook/infer/pull/799 Reviewed By: jvillard Differential Revision: D6284206 Pulled By: rgrig fbshipit-source-id: 6f1e8631fmaster
parent
686231ec6e
commit
344889775b
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2019-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
const char* GetVarint64Ptr(const char* p, const char* limit) {
|
||||
for (uint32_t shift = 0; shift <= 63 && p < limit; shift += 7) {
|
||||
uint64_t byte = *p;
|
||||
p++;
|
||||
if (!(byte & 128)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* data_;
|
||||
|
||||
void DecodeCurrentValue() {
|
||||
const char* limit = data_ + 1;
|
||||
const char* newp = GetVarint64Ptr(data_, limit);
|
||||
while (!newp) {
|
||||
}
|
||||
newp = GetVarint64Ptr(newp, limit);
|
||||
while (!newp) {
|
||||
}
|
||||
// TODO: ensure this does not trigger assertion failure in Absarray (see
|
||||
// T42274983)
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2019-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
// Command: infer -g --biabduction-only
|
||||
class T {
|
||||
static int q;
|
||||
|
||||
static void f() {
|
||||
if (q == 0) {
|
||||
q = 1;
|
||||
} else if (q == 1) {
|
||||
while (true) ;
|
||||
}
|
||||
}
|
||||
|
||||
static void h() {
|
||||
// Important to have 2 branches, and one of them is (q==1).
|
||||
if (q == 1) {
|
||||
} else if (q == 2) {
|
||||
}
|
||||
}
|
||||
|
||||
static void go() {
|
||||
q = 0;
|
||||
f();
|
||||
h(); // warning disappears if the NOP function h() is called here
|
||||
f(); // should warn of PRECONDITION_NOT_MET here
|
||||
}
|
||||
}
|
Loading…
Reference in new issue