| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| " arr[idx] = 0;\n" | ||
| "}\n"); | ||
| ASSERT_EQUALS( | ||
| "[test.cpp:9:8]: (error) Array 'arr[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\n", |
There was a problem hiding this comment.
Hi! I am new so sorry if this is a silly question.
I thought that if we want to return an error, we must be guaranteed that it is actually an error. In this input it looks like the array access is only out of bounds if c is true. Since we don't know anything about c, I thought we couldn't report any errors. I would expect the correct output for this testcase to be no errors.
Sorry, something went wrong.
|
I wonder if we could catch cases like this as well: int s[5];
void f()
{
short i;
for (i = 0; 1; i++)
{
if ( i == 4 )
break;
}
s[i] = 0;
}
which currently produces break.c:10:3: error: Array 's[5]' accessed at index 9999, which is out of bounds. [arrayIndexOutOfBounds] s[i] = 0; ^ break.c:5:2: note: After for loop, i has value 9999 for (i = 0; 1; i++) ^ break.c:10:3: note: Array index out of bounds s[i] = 0; |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.