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++/28236] wrong "control reaches" warning with enums.



------- Comment #3 from pluto at agmk dot net  2006-07-31 14:35 -------
one more testcase that renders different warning.

typedef enum { X, Y } e;
e zoo( e __e )
{
        e r;
        switch ( __e )
        {
                case X: r = Y; break;
                case Y: r = X; break;
        }
        return r;
}

bug.cpp: In function 'e zoo(e)':
bug.cpp:4: warning: 'r' may be used uninitialized in this function

e zoo(e) (__e)
{
  e r;
  e D.2076;
  int __e.0;
<bb 0>:
  switch ((int) __e)
    {
      case 0: goto <L0>;
      case 1: goto <L6>;
      default : goto <L5>;
    }
<L6>:;
  r = 0;
  goto <bb 3> (<L2>);
<L5>:;
  goto <bb 3> (<L2>);
<L0>:;
  r = 1;
<L2>:;
  return r;
}


-- 


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


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