...
MSC37-C-EX1: According to the C Standard, 5.1.2.23.34, paragraph 1 [ISO/IEC 9899:20112024], "Reaching the }
that terminates the main function returns a value of 0." As a result, it is permissible for control to reach the end of the main()
function without executing a return statement.
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Automated Detection
Tool | Version | Checker | Description | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Astrée |
| return-implicit | Fully checked | |||||||||||||||||
Axivion Bauhaus Suite |
| CertC-MSC37 | ||||||||||||||||||
CodeSonar |
| LANG.STRUCT.MRS | Missing return statement | |||||||||||||||||
Coverity |
| MISSING_RETURN | Implemented | |||||||||||||||||
Cppcheck |
| missingReturn | Fully implemented | |||||||||||||||||
Cppcheck Premium |
| missingReturn | Fully implemented | |||||||||||||||||
Helix QAC |
| C++4022 DF2888 | ||||||||||||||||||
Klocwork |
| FUNCRET.GEN | MISRA.RETURN.NOT_LASTFUNCRET.IMPLICIT | |||||||||||||||||
LDRA tool suite |
| 2 D, 36 S, 66 S | Fully implemented | |||||||||||||||||
Parasoft C/C++test |
| CERT_C-MSC37-a | All exit paths from a function, except main(), with non-void return type shall have an explicit return statement with an expression | |||||||||||||||||
PC-lint Plus |
| 533 | Fully supported | |||||||||||||||||
Polyspace Bug Finder |
| Missing return statement | Function does not return value though return type is not | PRQA QA-C | ||||||||||||||||
Include Page | PRQA QA-C_v | PRQA QA-C_v | 2888 | PRQA QA-C++ | ||||||||||||||||
Include Page | cplusplus:PRQA QA-C++_V | cplusplus:PRQA QA-C++_V | 2888, 4022CERT C: Rule MSC37-C | Checks for missing return statement (rule fully covered) | ||||||||||||||||
RuleChecker |
| return-implicit | Fully checked | |||||||||||||||||
SonarQube C/C++ Plugin |
| S935 | ||||||||||||||||||
TrustInSoft Analyzer |
| Body of function falls-through | Exhaustively verified. |
Related Guidelines
Key here (explains table format and definitions)
...
Bibliography
[ISO/IEC 9899:20112024] | 5.1.2.23.34, "Program Termination" |
...