[LLVMbugs] [Bug 22197] New: False warning: unsequenced modification and access to

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 11 11:52:29 PST 2015


            Bug ID: 22197
           Summary: False warning: unsequenced modification and access to
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stefanf at freebsd.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13667
  --> http://llvm.org/bugs/attachment.cgi?id=13667&action=edit
Source code showing the false warning

When compiling the attached code with -Wunsequenced, clang issues a warning
that I believe is incorrect:

$ c++ -Wunsequenced -c test.cpp           
test.cpp:5:12: warning: unsequenced modification and access to 'i'
    if ((i = f1(), true) && (j = f2(i))) {
           ^                        ~
1 warning generated.

There should be sequence points between the operands of the comma-operator and
those of &&.

If you wonder about "true", the code is generated and the condition will not
always be constant true.

Interestingly, the same code does not issue a warning when compiled as C code.

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/20150111/9f6491be/attachment.html>

More information about the llvm-bugs mailing list