https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667
--- Comment #64 from Patrick J. LoPresti ---
The C (and POSIX) standards have had "restrict" on the arguments to memcpy()
since C99. So calling it with overlapping arguments is undefined behavior and
always has been.
This bug should be trivial t
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109642
--- Comment #17 from Patrick J. LoPresti ---
Are all of the "duplicate" bugs also fixed by this change?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667
--- Comment #29 from Patrick J. LoPresti ---
(In reply to Jakub Jelinek from comment #27)
>
> No, that is not a reasonable fix, because it severely pessimizes common code
> for a theoretical only problem.
The very existence of (and interest in)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671
--- Comment #3 from Patrick J. LoPresti ---
(In reply to Andrew Pinski from comment #1)
> There is no way for GCC to know that get_foo_by_name does not store the
> argument into what is returned so it warns about this case ...
To summarize:
GC
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671
--- Comment #2 from Patrick J. LoPresti ---
Um... OK...
So I have to "correct" my code like so:
const Foo &bug(bool x)
{
const std::string s = (x ? "x" : "y");
const Foo &f = get_foo_by_name(s);
return f;
}
But if get_foo_by_name() has
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109671
Bug ID: 109671
Summary: Spurious dangling reference warning in GCC 13
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667
--- Comment #22 from Patrick J. LoPresti ---
I disagree that bug 108296 is a duplicate. That bug requires code that, at
least arguably, invokes undefined behavior. See e.g.
https://stackoverflow.com/q/7292862/ and https://stackoverflow.com/q/6107