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++/25181] [3.4 Regression] wrong "will never be executed" warning in switch - case block



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-11-30 16:11 -------
(In reply to comment #1)
> We should reject this.
But that is a different bug.
Anyways fixing up the code to be legal code:
extern int abort();

int test_18()
{
        int type;
        switch (type)
        {
        case 1:
 {               int ret = abort();
                if (ret != 0)
                        return 2;

                break;}

        case 3:
                break;

        default:
                return 1;
        }

        return 0;
}
---

We only warn for 3.4.x and below except 3.0.4 works so this is only a 3.4
regression.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |3.3.3 3.4.0
      Known to work|                            |3.0.4 4.0.0 4.1.0 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-11-30 16:11:44
               date|                            |
            Summary|wrong "will never be        |[3.4 Regression] wrong "will
                   |executed" warning in switch |never be executed" warning
                   |- case block                |in switch - case block
   Target Milestone|---                         |3.4.6


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


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