http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55949
Bug #: 55949 Summary: __builtin_object_size size passed to memcpy_chk is incorrect Classification: Unclassified Product: gcc Version: 4.6.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rmansfi...@qnx.com float m[3][3]; float im[3][3]; memcpy( im, m, sizeof( im ) ); $ ./xgcc -B. ~/r.i -O2 -S In function 'memcpy', inlined from 'foo' at /home/ryan/r.i:35:8: /home/ryan/r.i:7:3: warning: call to __builtin___memcpy_chk will always overflow destination buffer [enabled by default] generates: mov r2, #36 mov r3, #12 bl __memcpy_chk This happens on the 4.6 branch, but not in 4.7/4.8. It stopped happening on trunk after this change: http://gcc.gnu.org/viewcvs?view=revision&revision=179620 but then it becomes a direct call to memcpy instead of __memcpy_chk