[Bug c++/34470] New: [4.3.0 regression] spurious "is used uninitialized" from auto_ptr

zackw at panix dot com gcc-bugzilla@gcc.gnu.org
Fri Dec 14 21:18:00 GMT 2007


This test case provokes spurious "is used uninitialized" warnings from trunk
GCC.

  #include <string>
  #include <memory>
  class HashFunction {};
  HashFunction *get_hash (std::string const &);
  void generate_dsa_primes (void)
  { std::auto_ptr <HashFunction> hash(get_hash("SHA-160")); }

->

backward/auto_ptr.h: In function 'void generate_dsa_primes()':
backward/auto_ptr.h:177: warning: 'hash.std::auto_ptr<HashFunction>::_M_ptr'
  is used uninitialized in this function
dsa_gen.cc:6: note: 'hash.std::auto_ptr<HashFunction>::_M_ptr' 
  was declared here

This does not happen with 4.2.3.  Note that the warnings go away if you change
get_hash to take a const char * instead of a std::string const &, which seems
like it shouldn't matter.


-- 
           Summary: [4.3.0 regression] spurious "is used uninitialized" from
                    auto_ptr
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zackw at panix dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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



More information about the Gcc-bugs mailing list