https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82508

            Bug ID: 82508
           Summary: Possibly false positive implicit-fallthrough warning
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andreas.moog at warperbbs dot de
  Target Milestone: ---

#include <stdlib.h>

void nothing(int rtn_code)
{
    exit(rtn_code);
}

int x = 0;
int ch = 3;

int main() {
    switch (ch) {
    case 1:
        x=1;
        nothing(0);
    case 2:
        x=2;
        break;
    default:
        exit(1);
        }
    }

This produces a warning:

test-implicit-fallthrough.c:15:9: warning: this statement may fall through
[-Wimplicit-fallthrough=]
         nothing();
         ^~~~~~~~~
test-implicit-fallthrough.c:16:5: note: here

gcc (Debian 20170923-1) 8.0.0 20170923 (experimental) [trunk revision 253114]

Reply via email to