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: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Oct 2005 16:24:12 -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 #1 from ebotcazou at gcc dot gnu dot org 2005-10-22 16:24 -------
> In other word, the assignment:
>
> *(char *)(Current + 9) = my_computation (Current, i);
>
> as the effect of
>
> char * tmp = Current + 9
> *tmp = my_computation (Current, i);
>
> but this is incorrect because `Current' was actually modified by
> `my_computation' and thus we assign to the wrong location.
6.5.16 Assignment Operators
§4 The order of evaluation of the operands is unspecified.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24486