public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52167] New: self-assignment should at least produce use-of-uninitialized warning
@ 2012-02-08  8:24 darko.veberic at ung dot si
  2012-02-08  9:04 ` [Bug c++/52167] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: darko.veberic at ung dot si @ 2012-02-08  8:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52167

             Bug #: 52167
           Summary: self-assignment should at least produce
                    use-of-uninitialized warning
    Classification: Unclassified
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: darko.veberic@ung.si


the following code gets compiled without any warnings (even with -Wall
-Wextra):

std::string foo(foo);

and the resulting code segfaults (clang++ is also silent on this but the code
throws std::length_error).

i am aware that the example is ridiculous but it comes from a large real-life
project and is possibly a result of negligent copy-paste operations, so at
least issuing a warning would be nice.

full example:


#include <iostream>
#include <string>
using namespace std;

int
main()
{
  const string foo(foo);
  cout << foo << endl;
  return 0;
}


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-25 22:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08  8:24 [Bug c++/52167] New: self-assignment should at least produce use-of-uninitialized warning darko.veberic at ung dot si
2012-02-08  9:04 ` [Bug c++/52167] " redi at gcc dot gnu.org
2012-02-08 10:20 ` rguenth at gcc dot gnu.org
2012-02-08 14:01 ` manu at gcc dot gnu.org
2012-02-09  7:42 ` pinskia at gcc dot gnu.org
2012-10-25  9:16 ` manu at gcc dot gnu.org
2021-03-25 21:56 ` [Bug c++/52167] self-initialization " msebor at gcc dot gnu.org
2021-03-25 22:25 ` [Bug tree-optimization/52167] " msebor at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).