[Bug c/61689] New: Assignment and Operator not working as intended.

2014-07-03 Thread wmichaelv at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61689

Bug ID: 61689
   Summary: Assignment and Operator not working as intended.
   Product: gcc
   Version: 4.7.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wmichaelv at hotmail dot com

Created attachment 33063
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33063&action=edit
c code

iR = -iX * iR + iZ / iY * iA / (iA = iR = iC / iB);

Couldn't detect the source of error.
The output is displayed correctly in visual studio 2008, but not in gcc.

complete code is attached.


[Bug c/61689] Assignment and Operator not working as intended.

2014-07-03 Thread wmichaelv at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61689

--- Comment #2 from wmichaelv at hotmail dot com ---
(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.


[Bug c/61689] Assignment and Operator not working as intended.

2014-07-03 Thread wmichaelv at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61689

--- Comment #4 from wmichaelv at hotmail dot com ---
Ah, thank you. That clears it up. And my apology for my ignorant.