cc1plus prints

x.cc: In member function 'typename S10<T>::S12 S2::S5<T>::S13() [with T = S8
()()]':
x.cc:15: error: '<anonymous>' is used uninitialized in this function

in a gcc 4.4 trunk compilation of the C++ appended below for a 64-bit target. 
It's unclear what precisely is uninitialized here, and the same warning does
not appear for 32-bit targets.  This warning also doesn't appear in gcc 4.3.1
or earlier.

$ cat x.cc
struct S8 { template<typename T> S8(T) { } };

template<typename T> struct S10;
template<typename T> struct S10<T()> { typedef T S12; typedef S8 S1(); };

template<typename T> struct S3 { };
template<typename T> struct S11 { S11(S3<T>); };

struct S2
{
  template<typename T> operator S11<T>() { return S11<T>(S5<T>()); }
  template<typename T> struct S5:public S3<T>
  {
    virtual typename S10<T>::S12 S13() {
      return 0;
    }
  };
};

template<typename T> S11<T> S6(S3<T>) { return S11<T>(S3<T>()); }
template<typename S12> struct S7 { typedef S12 S15(); };

struct S4
{
  template<typename T> operator S11<T>()
  {
    struct S14:public S3<T>
    { 
      S14(S2 x):S11_(x) { }
      S11<typename S7<typename S10<T>::S12>::S15> S11_;
    };
    return S6(S14(S11_));
  }
  S2 S11_;
};

struct S9
{
  template<typename F> operator S11<F>() { return S11<F>(S14<F>(S11_)); }
  template<typename F> struct S14:public S3<F>
  {
    S14(S4 x):S11_(x) { }
    S11<typename S10<F>::S1> S11_;
  };
  S4 S11_;
};

void S15(S11<void()>);
void S16() { S9 x; S15(x); }

$ cc1plus -Werror -m32 -version -quiet x.cc -O1 -Wuninitialized -o /dev/null
GNU C++ (GCC) version 4.4.0 20090118 (experimental) (x86_64-unknown-linux-gnu)
   compiled by GNU C version 4.0.3 (Ubuntu 4.0.3-1ubuntu5), GMP version 4.2.2,
MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 3943547ae1329ecd45283a86831b8d94
$ echo $?
0

$ cc1plus -Werror -m64 -version -quiet x.cc -O1 -Wuninitialized -o /dev/null
GNU C++ (GCC) version 4.4.0 20090118 (experimental) (x86_64-unknown-linux-gnu)
   compiled by GNU C version 4.0.3 (Ubuntu 4.0.3-1ubuntu5), GMP version 4.2.2,
MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 3943547ae1329ecd45283a86831b8d94
cc1plus: warnings being treated as errors
x.cc: In member function 'typename S10<T>::S12 S2::S5<T>::S13() [with T = S8
()()]':
x.cc:15: error: '<anonymous>' is used uninitialized in this function
$ echo $?
1


-- 
           Summary: Unexplained "'<anonymous>' is used uninitialized in this
                    function" warning in cc1plus -m64
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com
 GCC build triplet: i386-unknown-linux-gnu
  GCC host triplet: i386-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to