[llvm-bugs] [Bug 25521] New: False positive Wreturn-type warning
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 13 07:53:01 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25521
Bug ID: 25521
Summary: False positive Wreturn-type warning
Product: clang
Version: 3.7
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: yyc1992 at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The following code gives a warning about control flow reaching the end of
function without returning a value even though the function will always reach
the `return 1;` statement and won't reach the end of the function.
```
int f()
{
for (int i = 1;--i >= 0;) {
return 1;
}
}
```
Given no warning about this is given if the loop condition is replaced with `1`
I hope it is also possible for clang to figure out that the loop is executed as
least once and silence the warning.
This (admittedly stupid....) code pattern arise from macro expansion to setup a
single time local context.
Ref GCC bug report https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68336
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151113/c9d78a42/attachment.html>
More information about the llvm-bugs
mailing list