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

            Bug ID: 57681
           Summary: Possible missing break in cp-array-notation.c
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

I just ran the static analysis tool "cppcheck" over
the trunk source code dated 20130623.

It said

[trunk/gcc/cp/cp-array-notation.c:471] ->
[trunk/gcc/cp/cp-array-notation.c:473]: (warning) Variable 'init' is reassigned
a value before the old one has been used. 'break;' missing?

Source code is

    case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND:
    case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND:
      code = an_type == BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND ? LE_EXPR
    : GE_EXPR;
      init = an_loop_info[0].var;
    case BUILT_IN_CILKPLUS_SEC_REDUCE:
      init = identity_value;
      break;

Suggest add break statement.

Also, case BUILT_IN_CILKPLUS_SEC_REDUCE is the only case that doesn't
assign to code. That might be a bug.

Reply via email to