Showing error 1485

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: loops/invert_string_safe.i
Line in file: 3
Project: SV-COMP 2013
Project version: 2.6.28
Tools: Manual Work
Entered: 2013-01-17 16:57:54 UTC


Source:

 1void __VERIFIER_assert(int cond) {
 2  if (!(cond)) {
 3    ERROR: goto ERROR;
 4  }
 5  return;
 6}
 7char __VERIFIER_nondet_char();
 8
 9int main() {
10    unsigned int max = 5;
11    char str1[max], str2[max];
12    int i, j;
13
14    for (i=0; i<max; i++) {
15        str1[i]=__VERIFIER_nondet_char();
16    }
17
18    str1[max-1]= '\0';
19
20    j = 0;
21
22    for (i = max - 1; i >= 0; i--) {
23        str2[j] = str1[i];
24        j++;
25    }
26
27    j = max-1;
28    for (i=0; i<max; i++) {
29      __VERIFIER_assert(str1[i] == str2[j]);
30      j--;
31    }
32}