http://llvm.org/bugs/show_bug.cgi?id=21908

            Bug ID: 21908
           Summary: Detect unnecessary postfix ++ or --
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

In code like this:

 1:    i = 32767 + read_help_topic(INTRO_AUTHORS, 0, 32767, screen_text);
 2:    screen_text[i++] = '\0';
 3:    i = 32767 + read_help_topic(INTRO_CREDITS, 0, 32767, credits);
 4:    credits[i++] = '\0';
 5:
 6:    j = 0;
 7:    authors.push_back(0);               /* find the start of each
credit-line */
 8:    for (i = 0; credits[i] != 0; i++)
 9:        if (credits[i] == 10)
10:            authors.push_back(i+1);
11:    authors.push_back(i);

The postfix ++ applied on lines 2 and 4 result in a modification to i that is
never read, but deadcode.DeadStores doesn't report this.

See attached source, lines 40-43 in intro.cpp

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to