This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21310] New: warning: '<anonymous>' may be used uninitialized in this function


Current mainline GCC generate strage warnings with -O -Wuninitialized options 
if compile testcase:

--8X---------------------------------
#include<map>

struct W {
  static int g(int v) { return std::min(v,0); }
};

struct R {
  R();
  R(int v);
  int m;
};

int main() {
  std::map<int,R> e;
  e[0] = R(W::g(0));
}
--X8------------------------------

Output:
test.cc: In function 'int main()':
test.cc:4: warning: '<anonymous>' may be used uninitialized in this function
test.cc:15: warning: 'v' may be used uninitialized in this function

GCC 4.0.0 compile with same options without warnings.

Vladimir

-- 
           Summary: warning: '<anonymous>' may be used uninitialized in this
                    function
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wanderer at rsu dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-freebsd5.3
  GCC host triplet: i386-unknown-freebsd5.3
GCC target triplet: i386-unknown-freebsd5.3


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]