benedekaibas wrote:

> @benedekaibas Can you post an example FP html finding here? I could maybe 
> reproduce and create a test case for you in the background.

[report-3efbc2.html](https://github.com/user-attachments/files/30700407/report-3efbc2.html)

In the meantime I could reproduce the error. As a note for the AI policy, after 
my implementation of the test case that triggered the FP I asked AI to ask me 
questions which would help me to reduce the number of lines since I had a 
pretty long test case. This code snippet is the result of that refactor:

```
namespace repro {
struct PunnedPointer {
  unsigned char Data[sizeof(void *)];
  PunnedPointer(long V = 0) { *this = V; }
  PunnedPointer &operator=(long V) {
    __builtin_memcpy(Data, &V, sizeof(Data));
    return *this;
  }
};
} // namespace repro

struct PointerUnion {
  repro::PunnedPointer Val;
  PointerUnion(const int *V) { Val = reinterpret_cast<long>(V); }
};

void foo(PointerUnion arg);

void no_dangling_by_value_argument() {
  int local = 0;
  foo(&local); // no-warning
}
```

https://github.com/llvm/llvm-project/pull/213779
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to