| Summary: | Parser flags a function as in error when return comes after a goto label | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Baker <nathanb> |
| 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, malaperle, nathanb, xhpohanka, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
I can't reproduce that error. I think this has been fixed already (see bug 346559). Any chance the change could get pulled into a 7.0.x build? Not all of us are using unreleased versions of CDT. 8.0 has been released since June, hasn't it? Does not appear to be fixed in build 8.0.0.201106081058 I still see the same problem. I can confirm this behavior. It occurs only when the return statement is immediately after the label.
/*
* aaa.c
*
* Created on: 7.10.2011
* Author: honza
*/
int x(void)
{
int aa = 0;
if (aa > 0)
goto label;
return 0;
label:
return -1;
}
Do you still experience this error with CDT 8.2? I can't reproduce it. I can confirm that I cannot reproduce described behavior in actual builds. Seems to be fixed. I confirm as well...the same code which reproduced the error earlier no longer reproduces it. *** This bug has been marked as a duplicate of bug 346559 *** |
Build Identifier: 20110615-0604 If a function in a project has a return type, the parser will flag it as not returning a value if the return statement follows a goto label. The error message reads "No return, in function returning non-void" Reproducible: Always Steps to Reproduce: static int foo(int argc, char** argv) { if (argc > 0) { goto done; } done: return 0; }