simplecpp icon indicating copy to clipboard operation
simplecpp copied to clipboard

wrong location for tokens

Open danmar opened this issue 3 years ago • 1 comments

Reported in the cppcheck forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/9c0ae79e38/?limit=25

Example code:

int main()
{   
    char* ptr = 0;
#line 16 "main.sc"
{
#line 12 "main.sc"
    struct sqlexd sqlstm;
}
#line 16 "main.sc"
    strcpy(ptr, "bad");
}

Cppcheck reports this:

main.sc:21:12: error: Null pointer dereference: ptr [nullPointer]

The linenumber should not be 21 it should be 16.

danmar avatar Jun 20 '22 18:06 danmar