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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to wmichaelv from comment #2)
> (In reply to Marek Polacek from comment #1)
> > The program has undefined behaviour; an assignment is not a sequence point. 
> > See what -Wsequence-point says.
> 
> According to the order operation, grouping should be calculated first before
> add, subtract, division, and multiplication, and assignment. And the
> associativity of assignment is from right to left.

Where in the standard does it say so?

http://stackoverflow.com/questions/22817517/do-parentheses-force-order-of-evaluation-and-make-an-undefined-expression-define

Clang also believes this code is broken (it looks broken to me):

test.c:13:37: warning: unsequenced modification and access to 'iA'
[-Wunsequenced]
        iR = -iX * iR + iZ / iY * iA / (iA = iR = iC / iB);
                                  ~~       ^
test.c:13:42: warning: unsequenced modification and access to 'iR'
[-Wunsequenced]
        iR = -iX * iR + iZ / iY * iA / (iA = iR = iC / iB);
                   ~~                           ^
2 warnings generated.

Reply via email to