[Bug c/69661] New: missing -Wsequence-point warning

chengniansun at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Feb 3 23:56:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69661

            Bug ID: 69661
           Summary: missing -Wsequence-point warning
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code has a sequence point violation, but gcc does not emit a
warning. 


$: cat small.c
int a, b;
short c;
void fn1(int p) {}

void fn2() { fn1(a == (c &= a = b)); }
$: 
$: gcc-5.1 -Wsequence-point -c small.c
$: 
$: clang-3.9 -Wunsequenced -c small.c
small.c:5:31: warning: unsequenced modification and access to 'a'
[-Wunsequenced]
void fn2() { fn1(a == (c &= a = b)); }
                 ~            ^
1 warning generated.
$: 
$:


More information about the Gcc-bugs mailing list