This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/24486] gcc generates incorrect assignment because of reordering



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]