[Bug tree-optimization/50417] regression: memcpy with known alignment

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 8 12:56:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50417

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Doesn't sanitize anything for

int main()                                                                      
{                                                                               
  int i, j;                                                                     
  memcpy (&i, (int *)((char *)&i + 1), 4);                                      
  return 0;                                                                     
}

but note that the cast to (int *) is already removed during early folding
and you end up with GENERIC

  memcpy ((void *) &i, (const void *) (&i + 1), 4);


More information about the Gcc-bugs mailing list