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

            Bug ID: 67661
           Summary: Wrong warning when declare VLAs: operation on 'b' may
                    be undefined [-Wsequence-point]
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: leechung at 126 dot com
  Target Milestone: ---

The following code produces a warning: operation on 'b' may be
undefined.[-Wsequence-point]

int x = 0, y [++ x], z [++ x];

But N1570 6.8 says:
A block allows a set of declarations and statements to be grouped into one
syntactic unit. The initializers of objects that have automatic storage
duration, and the variable length array declarators of ordinary identifiers
with block scope, are evaluated and the values are stored in the objects
(including storing an indeterminate value in objects without an initializer)
each time the declaration is reached in the order of execution, as if it were a
statement, and within each declaration in the order that declarators appear.

and 6.7.6 says:
A full declarator is a declarator that is not part of another declarator. The
end of a full declarator is a sequence point.

Reply via email to