Issue 129842
Summary [asan] failure to detect memory leaks
Labels new issue
Assignees
Reporter PikachuHyA
    reproducer
see https://godbolt.org/z/6YGdnn634

```c++
// main.cc
struct Foo {
  struct Foo *other;
};
int main() {
  auto f1 = new Foo();
  auto f2 = new Foo();
  f1->other = f2;
  f2->other = f1;
  return 0;
}

```

However, the following memory leaks detected.

see https://godbolt.org/z/n6jWbYTqY

```c++
struct Foo {
  struct Foo *other;
};
int main() {
  auto f1 = new Foo();
  auto f2 = new Foo();
 f1->other = f2;
  // highlight here
  // f2->other = f1;
  return 0;
}
```


Note: GCC can detect the memory leaks.
if use `-fsanitize=leak`, the memory leaks detected.



_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to