https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72787
--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 4 Aug 2016, ranjan.winner at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72787 > > --- Comment #6 from martin <ranjan.winner at gmail dot com> --- > (In reply to Richard Biener from comment #1) > > You can't rely on __builtin_object_size this way, please look up its > > documentation. > > Hi Richard, > > Are you pointing to this line of test-case : > > size_t _sz = __builtin_object_size(dst, 1); > > That we can't rely on __builtin_object_size this way. > I am getting wrong size only if I use __restrict qualifier, otherwise it > calculate correct size. > > Also if we directly print the value of "__builtin_object_size(dst, 1)", then > I > am getting correct size. You are always getting a conservative size. Note that GCC 4.6 is no longer maintained so this but is pointless.