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

--- Comment #17 from amker at gcc dot gnu.org ---
(In reply to Mikael Pettersson from comment #16)
> (In reply to amker from comment #15)
> > Well, only thing suspicious that I can see, the memset function is a special
> > implementation and not from C standard library.  Basically it doesn't need
> > to follow the standard, which means the return value could be something else
> > other than the passed in pointer.  Though I doubt it would actually break
> > the standard.
> > 
> > So YuFan, could you help look into implementation of memset to see if it
> > acts as expected?
> > 
> > Thanks.
> 
> I recall seeing reports of the Linux/ARM kernel being miscompiled by gcc-4.8
> (or so) a while ago, and it was traced to an in-kernel memset() (or related
> mem/str-function) implementation not following the same return value
> convention as the normal user-space version.  The problem is that newer
> gcc:s optimize some mem/str-functions based on those return value
> conventions, so things broke.  The 2.6.28 kernel is ancient, so it's not at
> all surprising it won't work when compiled by non-ancient gcc:s.

Ah, I checked the architecture implementation of memset on ARM in 2.6.28
kernel, seems to me it does operate on r0/arg1 directly and return the modified
register.  This means it does violate the standard.

Hi YuFan, It seems to me GCC works fine, you may need to confirm the finding
here and patch the implementation of memset.

Thanks.

Reply via email to