public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61689] New: Assignment and Operator not working as intended.
@ 2014-07-03 15:08 wmichaelv at hotmail dot com
  2014-07-03 15:11 ` [Bug c/61689] " mpolacek at gcc dot gnu.org
  2014-07-03 15:51 ` manu at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: wmichaelv at hotmail dot com @ 2014-07-03 15:08 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/61689] Assignment and Operator not working as intended.
  2014-07-03 15:08 [Bug c/61689] New: Assignment and Operator not working as intended wmichaelv at hotmail dot com
@ 2014-07-03 15:11 ` mpolacek at gcc dot gnu.org
  2014-07-03 15:51 ` manu at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-07-03 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |mpolacek at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The program has undefined behaviour; an assignment is not a sequence point. 
See what -Wsequence-point says.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/61689] Assignment and Operator not working as intended.
  2014-07-03 15:08 [Bug c/61689] New: Assignment and Operator not working as intended wmichaelv at hotmail dot com
  2014-07-03 15:11 ` [Bug c/61689] " mpolacek at gcc dot gnu.org
@ 2014-07-03 15:51 ` manu at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2014-07-03 15:51 UTC (permalink / raw)
  To: gcc-bugs

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.
>From gcc-bugs-return-455586-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 03 15:54:10 2014
Return-Path: <gcc-bugs-return-455586-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23705 invoked by alias); 3 Jul 2014 15:54:09 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 23516 invoked by uid 48); 3 Jul 2014 15:54:01 -0000
From: "ktietz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/61628] [MinGW)Write of medium sized or larger matrix fails without error message.
Date: Thu, 03 Jul 2014 15:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ktietz at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-61628-4-SYoJeO150F@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61628-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61628-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg00177.txt.bz2
Content-length: 714

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

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

--- Comment #19 from Kai Tietz <ktietz at gcc dot gnu.org> ---
I tested sample in comment #14 with mingw-w64 on 32-bit and 64-bit.

My results are for 64-bit:

On compile already the error-message: 'Schwerwiegender Fehler: Feldelementgröße
bei (1) zu groß'

Interestingly on 32-bit compile works and on execution the word 'begin' is
written. Afterwards process terminates normal in gdb.
>From gcc-bugs-return-455587-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 03 16:19:00 2014
Return-Path: <gcc-bugs-return-455587-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20740 invoked by alias); 3 Jul 2014 16:18:59 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20643 invoked by uid 48); 3 Jul 2014 16:18:51 -0000
From: "wmichaelv at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/61689] Assignment and Operator not working as intended.
Date: Thu, 03 Jul 2014 16:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.7.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: wmichaelv at hotmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61689-4-Wo74l8fFK6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61689-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61689-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg00178.txt.bz2
Content-length: 172

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida689

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-03 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03 15:08 [Bug c/61689] New: Assignment and Operator not working as intended wmichaelv at hotmail dot com
2014-07-03 15:11 ` [Bug c/61689] " mpolacek at gcc dot gnu.org
2014-07-03 15:51 ` manu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).