8000 src/hlua.c: unreachable code suspected by coverity · Issue #2924 · haproxy/haproxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

src/hlua.c: unreachable code suspected by coverity #2924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chipitsine opened this issue Apr 4, 2025 · 3 comments
Closed

src/hlua.c: unreachable code suspected by coverity #2924

chipitsine opened this issue Apr 4, 2025 · 3 comments
Labels
type: code-report This issue describes a code report (like valgrind or coverity)

Comments

@chipitsine
Copy link
Member

Tool Name and Version

coverity

Code Report

*** CID 1596122:  Control flow issues  (UNREACHABLE)
/src/hlua.c: 5413 in hlua_applet_tcp_recv_try()
5407                    /* return the result. */
5408                    luaL_pushresult(&luactx->b);
5409                    return 1;
5410            }
5411     
5412            /* we never execute this */
>>>     CID 1596122:  Control flow issues  (UNREACHABLE)
>>>     This code cannot be reached: "hlua_pusherror(L, "Lua: int...".
5413            hlua_pusherror(L, "Lua: internal error");
5414            WILL_LJMP(lua_error(L));
5415            return 0;
5416     }
5417     
5418     /* If expected data not yet available, it returns a yield. This function

Additional Information

No response

Output of haproxy -vv

no
@chipitsine chipitsine added the type: code-report This issue describes a code report (like valgrind or coverity) label Apr 4, 2025
@Darlelet
Copy link
Contributor
Darlelet commented Apr 4, 2025

Indeed this is expected as the comment suggests but left that way so that compilers don't complain about the function missing a return statement

You can mark this one as intended, thanks!

@chipitsine chipitsine closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2025
@wtarreau
Copy link
Member
wtarreau commented Apr 4, 2025

Another way to deal with this is to mark the location unreachable:

if (...) {
  ...
}
my_unreachable();

The compiler will then understand that this may never happen and will not complain.

@Darlelet
Copy link
Contributor
Darlelet commented Apr 4, 2025

Thanks for the tip Willy! will try to remind myself about that one next time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code-report This issue describes a code report (like valgrind or coverity)
Projects
None yet
Development

No branches or pull requests

3 participants
0