Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated references from C11->C23

...

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

MISRA.RETURN.NOT_LASTcplusplus:PRQA QA-C++_V
ToolVersionCheckerDescription
Astrée
Include Page
Astrée_V
Astrée_V
return-implicitFully checked
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC-MSC37
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V
LANG.STRUCT.MRSMissing return statement
Coverity
Include Page
Coverity_V
Coverity_V

MISSING_RETURN

Implemented
Cppcheck

Include Page
Cppcheck_V
Cppcheck_V

missingReturnFully implemented
Cppcheck Premium

Include Page
Cppcheck Premium_V
Cppcheck Premium_V

missingReturnFully implemented
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C++4022

DF2888


Klocwork
Include Page
Klocwork_V
Klocwork_V
FUNCRET.GEN
FUNCRET.IMPLICIT
LDRA tool suite
Include Page
LDRA_V
LDRA_V
2 D, 36 S, 66 SFully implemented
Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V

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

Include Page
PC-lint Plus_V
PC-lint Plus_V

533

Fully supported

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C: Rule MSC37-CChecks for missing return statement (rule fully covered)PRQA QA-C
Include Page
PRQA QA-C_vPRQA QA-C_v2888PRQA QA-C++
Include Page

cplusplus:PRQA QA-C++_V2888, 4022 


RuleChecker
Include Page
RuleChecker_V
RuleChecker_V
return-implicitFully checked
SonarQube C/C++ Plugin

Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V

S935
TrustInSoft Analyzer

Include Page
TrustInSoft Analyzer_V
TrustInSoft Analyzer_V

Body of function falls-throughExhaustively verified.

Related Guidelines

Key here (explains table format and definitions)

...

Bibliography

[ISO/IEC 9899:20112024]5.1.2.23.34, "Program Termination"


...