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

            Bug ID: 57880
           Summary: cp/parser.c: 6 * missing break ?
           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 checker "cppcheck" over the source code
of trunk 20130710. It said

Checking trunk/gcc/cp/parser.c...
[trunk/gcc/cp/parser.c:12465] -> [trunk/gcc/cp/parser.c:12468]: (warning)
Variable 'string_len' is reassigned a value before the old one has been used.
'break;' missing?
[trunk/gcc/cp/parser.c:12468] -> [trunk/gcc/cp/parser.c:12470]: (warning)
Variable 'string_len' is reassigned a value before the old one has been used.
'break;' missing?
[trunk/gcc/cp/parser.c:12508] -> [trunk/gcc/cp/parser.c:12511]: (warning)
Variable 'string_len' is reassigned a value before the old one has been used.
'break;' missing?
[trunk/gcc/cp/parser.c:12511] -> [trunk/gcc/cp/parser.c:12513]: (warning)
Variable 'string_len' is reassigned a value before the old one has been used.
'break;' missing?

Source code is

    case CPP_WSTRING_USERDEF:
      string_len = 3;
    case CPP_STRING16_USERDEF:
    case CPP_STRING32_USERDEF:
      string_len = 5;
    case CPP_UTF8STRING_USERDEF:
      string_len = 4;
      bad_encoding_prefix = true;
    case CPP_STRING_USERDEF:

Code obviously broken. Suggest rework and maybe a look at related bug # 
7652 would also help.

Reply via email to