This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/24486] gcc generates incorrect assignment because of reordering
- From: "dnovillo at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Oct 2005 17:32:55 -0000
- Subject: [Bug c/24486] gcc generates incorrect assignment because of reordering
- References: <bug-24486-9608@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from dnovillo at redhat dot com 2005-10-22 17:32 -------
Subject: Re: gcc generates incorrect assignment because of reordering
On Saturday 22 October 2005 13:20, manus at eiffel dot com wrote:
> Would it make sense to have a new option in `gcc' to say that target is
> always evaluated after source is?
>
Not really possible. You are correct that it occurs at any optimization
level.
The bug in your code is exposed when GCC creates the intermediate
representation for your program. In that intermediate representation, GCC
is explicitly exposing the sequence points in expression evaluation using
the standard rules.
Your program breaks simply because it is not following the sequence points
dictated by the standard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24486