Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Parasoft C/C++test 10.4

...

Tool

Version

Checker

Description

Astrée
Include Page
Astrée_V
Astrée_V
pointered-deallocationFully checked
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V
LANG.STRUCT.RPLReturns pointer to local
Compass/ROSE

Can detect violations of this rule. It automatically detects returning pointers to local variables. Detecting more general cases, such as examples where static pointers are set to local variables which then go out of scope, would be difficult

Coverity

Include Page
Coverity_V
Coverity_V

RETURN_LOCAL

Finds many instances where a function will return a pointer to a local stack variable. Coverity Prevent cannot discover all violations of this rule, so further verification is necessary

Klocwork
Include Page
Klocwork_V
Klocwork_V

LOCRET.ARG
LOCRET.GLOB

LOCRET.RET

LDRA tool suite
Include Page
LDRA_V
LDRA_V

42 D, 77 D, 71 S, 565 S

Enhanced Enforcement
Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V

CERT_C-DCL30-a
CERT_C-DCL30-b

The address of an object with automatic storage shall not be returned from a function
The address of an object with automatic storage shall not be assigned to another object that may persist after the first object has ceased to exist

MISRA2004-17_6_a, MISRA2004-17_6_b

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

Pointer or reference to stack variable leaving scope

MISRA C:2012 Rule 18.6

Pointer to local variable leaves the variable scope

The address of an object with automatic storage shall not be copied to another object that persists after the first object has ceased to exist

PRQA QA-C
Include Page
PRQA QA-C_v
PRQA QA-C_v

3217
3225
3230
4140

Partially implemented
PRQA QA-C++
Include Page
cplusplus:PRQA QA-C++_V
cplusplus:PRQA QA-C++_V

2515, 2516, 2527, 2528, 4026, 4624, 4629


PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V506, V507, V558, V623, V723, V738


Splint
Include Page
Splint_V
Splint_V


...