[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#619963: gcc-4.6: wrongly optimizes memmove() into memcpy()



severity  619963 important
thanks

On 28.03.2011 19:10, Remi Denis-Courmont wrote:
> Package: gcc-4.6
> Version: 4.6.0-1
> Severity: grave
> Justification: renders package unusable

does it?

> Trying to compile VLC media player using Debian gcc-4.6.
> It turns out that the compiler is silently replacing memmove() calls
> with memcpy() ones, when it is clearly NOT a legal optimization. The
> issue was uncovered with valgrind. For instance, this one is failing,
> even though both source and destination obviously overlap:
> 
>      memmove( &p_aout->pp_inputs[i_input], &p_aout->pp_inputs[i_input + 1],
>               (AOUT_MAX_INPUTS - i_input - 1) * sizeof(aout_input_t *) );
> 
> This results in memory corruption at run-time and eventually crashes.
> 
> Compiler flags used were: -g -O2 -ffast-math -funroll-loops -fPIC
> I can provide the full .i file if needed.

please could you provide a test case?

thanks, Matthias



Reply to: