[llvm-bugs] [Bug 37999] New: Unsequenced warnings displayed inconsistently

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 30 04:42:42 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37999

            Bug ID: 37999
           Summary: Unsequenced warnings displayed inconsistently
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dilyan.palauzov at aegee.org
                CC: llvm-bugs at lists.llvm.org

With this program:

#include <ctype.h>
#include <stdio.h>

int main() {
  char g[] = "ABC";
  int i =0;
  g[i] = tolower(g[i++]);
  printf("g=%s, i=%i\n", g, i);
}

and clang 6.0.0 (not 6.0.1) I get:

$ clang -O0 plus.c
plus.c:7:21: warning: unsequenced modification and access to 'i'
[-Wunsequenced]
  g[i] = tolower(g[i++]);
    ~               ^
1 warning generated.

but 
$ clang -O1 plus.c
-> No warnings

As the first call (-O0) emits warnings, I would expect that the second call
(-O1) emits the same warnings.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180630/07a0fb8a/attachment.html>


More information about the llvm-bugs mailing list