Issue 175957
Summary MSan reports undefined behavior when inserting string keys into `std::map`
Labels new issue
Assignees
Reporter david-cortes-intel
    From https://github.com/uxlfoundation/oneDAL/pull/3304#issuecomment-3748912408

Using `-fsanitize=memory` reports undefined behavior when dynamically inserting elements into an `std::map` object whose keys are either `std::string` or `const char*` string literals:
```cpp
#include <map>
#include <string>
#include <cstdint>

struct false_positive_test {
 false_positive_test() {
        info_["key1"] = 42;
 info_["key2"] = 84;
    }
protected:
    std::map<std::string, uint64_t> info_;
};

int main() {
    false_positive_test test;
    return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to