File: test-29-safe.cpp

package info (click to toggle)
ikos 3.5-2
  • links: PTS, VCS
  • area: non-free
  • in suites: sid
  • size: 11,896 kB
  • sloc: cpp: 102,890; python: 6,471; ansic: 5,860; sh: 2,409; javascript: 348; makefile: 16
file content (23 lines) | stat: -rw-r--r-- 421 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <memory>

struct MyStruct {
  int _aa;
  int _bb;
  MyStruct() noexcept
  {
    _aa = 5;
    _bb = 7;
  }
};

int main(int argc, char *argv[])
{
  // This test gives a false positive because the ikos AR
  // does not assure that the body is executed at least once.
  // That could probably be fixed.
  MyStruct* test1 = nullptr;
  for(int i = 0; i < 2;i++) {
    test1 = new MyStruct;
  }
  return test1->_aa;
}