This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug c/24486] gcc generates incorrect assignment because of reordering
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-bugs at gcc dot gnu dot org, gcc-bugzilla at gcc dot gnu dot org
- Date: Sat, 22 Oct 2005 13:32:41 -0400
- Subject: Re: [Bug c/24486] gcc generates incorrect assignment because of reordering
- References: <bug-24486-9608@http.gcc.gnu.org/bugzilla/> <20051022172054.32243.qmail@sourceware.org>
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.