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

2005-10-22 Thread dnovillo at redhat dot com
--- Comment #7 from dnovillo at redhat dot com 2005-10-22 17:42 --- Subject: Re: gcc generates incorrect assignment because of reordering On Saturday 22 October 2005 13:32, Diego Novillo wrote: > The bug in your code is exposed when GCC creates the intermediate > representation for yo

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

2005-10-22 Thread Diego Novillo
On Saturday 22 October 2005 13:32, Diego Novillo wrote: > 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.

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

2005-10-22 Thread ebotcazou at gcc dot gnu dot org
--- Comment #6 from ebotcazou at gcc dot gnu dot org 2005-10-22 17:34 --- > Would it make sense to have a new option in `gcc' to say that target is always > evaluated after source is? I think that would make transition to gcc 4.0. No, the compiler has already far too many command line

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

2005-10-22 Thread dnovillo at redhat dot com
--- 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 > alway

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

2005-10-22 Thread Diego Novillo
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 G

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

2005-10-22 Thread manus at eiffel dot com
--- Comment #4 from manus at eiffel dot com 2005-10-22 17:20 --- I agree that relying on gcc's behavior might be the wrong thing to do, but when this is 15 years old code, you can expect that it will still continue to work. Moreover, it works on all the C compilers I've ever used except

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

2005-10-22 Thread ebotcazou at gcc dot gnu dot org
--- Comment #3 from ebotcazou at gcc dot gnu dot org 2005-10-22 16:50 --- > In other words this is a breaking change. The change breaks nothing except invalid code. Your code has worked by accident up to now with GCC, it may never have worked with another compiler. > Is there an expl

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

2005-10-22 Thread manus at eiffel dot com
--- Comment #2 from manus at eiffel dot com 2005-10-22 16:37 --- I'm fine that you comply to the standard, but what I was reporting was not an incoherence with the standard, but with the fact that for the past 15 years `gcc' has always evaluated the source before evaluating the target.

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

2005-10-22 Thread ebotcazou 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