On Wed, Jan 9, 2013 at 5:33 PM, Ondřej Bílka <nel...@seznam.cz> wrote:
> On Wed, Jan 09, 2013 at 05:12:06PM +0100, Marc Glisse wrote:
>> On Wed, 9 Jan 2013, Ondřej Bílka wrote:
>>
>> >gcc currently does not even optimize following fragment:
>> >
>> >int foo(){
>> > char *x=malloc(64);
>> > free(x);
>> >}
>>
>> Yes it does.
>> (not that more optimizations aren't possible, but it does this one)
> Sorry I did checked this only with old gcc. Recent gcc does eliminates
> this by DCE which was not point of that example.
>
> This is correct example.
>
> int foo(){
>  char *x=malloc(64);
>   x[3]=4;
>   int z=x[3];
>  free(x);
>   return z;
> }

There is a bug that tracks this already.

Richard.

>>
>> --
>> Marc Glisse
>

Reply via email to