| Summary: | parser does not detect return value | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Martin Gerhardy <martin.gerhardy> | ||||
| Component: | cdt-codan | Assignee: | CDT Codan Inbox <cdt-codan-inbox> | ||||
| Status: | CLOSED DUPLICATE | QA Contact: | Elena Laskavaia <elaskavaia.cdt> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, frantas, malaperle, yevshif, zeratul976 | ||||
| Version: | 8.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
the reported warning is: "Description Resource Path Location Type No return, in function returning non-void infostring.c /ufoai/src/shared line 39 Code Analysis Problem" looks this bug is also triggered for:
int foo(void) {
[...]
{
return 0;
}
}
For the case from comment 2, this was already fixed (bug 345687) For the case from attachment 198671 [details] - the warning is reported because control flow analysis looks into control structures, but not values. Hence it doesn't know that the `while` is an infinite loop, it assumes there is a branch out of the loop and it leads to no return. A simplified test case: int foo() { int a = 5; while (1) { --a; if (a == 0) { return 5; } } } Data flow analysis is planned for the future. Alena, shall we make a workaround for the time being? propose new summary -> [fp] Wrong warning "No return, in function returning non-void" after a while(1) loop I would just leave it as false positive now - analyzing loops for to be infinitive is quite difficult This appears to be fixed by the patch for bug 394521. I think we can close as duplicate. *** This bug has been marked as a duplicate of bug 394521 *** |
Created attachment 198671 [details] the parser does not detect the return value the parser does not detect the return value of the attached function