Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bogus warning: 'memset' will always overflow; destination buffer has size 1, but size argument is 2 [-Wfortify-source] #124513

Copy link
Copy link
Closed
@stbergmann

Description

@stbergmann
Issue body actions

On recent LLVM trunk (towards LLVM 20), bisecting shows that 0a9c08c "[Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (#95474)" started to cause

$ cat test.cc
#include <cstring>
struct S { char m1, m2; };
void f(S & x) { std::memset(&x, 0, sizeof (S)); }
$ clang++ -std=c++23 -fsyntax-only test.cc
test.cc:3:17: warning: 'memset' will always overflow; destination buffer has size 1, but size argument is 2 [-Wfortify-source]
    3 | void f(S & x) { std::memset(&x, 0, sizeof (S)); }
      |                 ^
1 warning generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.