Skip to content
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

[warning] Don't report function returns address of local variable #117425

Open
vfdff opened this issue Nov 23, 2024 · 0 comments
Open

[warning] Don't report function returns address of local variable #117425

vfdff opened this issue Nov 23, 2024 · 0 comments
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@vfdff
Copy link
Contributor

vfdff commented Nov 23, 2024


int *foo() {
    int *p = 0;
    {
        int x = 0;
        p = &x;
        *p = 42;
    }
    *p = 42;
    return p;
}
  • I already use -Wall to report all warning, but the dangling pointer is not identified by clang
@EugeneZelenko EugeneZelenko added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer and removed new issue labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
Development

No branches or pull requests

2 participants