[Bug target/111165] [13 regression] builtin strchr miscompiles on Debian/x32 with dietlibc

arsen at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 5 21:23:06 GMT 2024


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

Arsen Arsenović <arsen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arsen at gcc dot gnu.org

--- Comment #24 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
(In reply to Thorsten Glaser from comment #6)
> dietlibc’s strlen is a horrid SSE nightmare that doesn’t call (f)emms, but
> it has a switch global variable __valgrind, if setting that to 1 it uses a
> very traditional loop instead, and the registers before/after strlen also
> match (only rax has changed), so I’m at a loss.
> 
> Changing the line to…
> 
> sp += strlen(sp) + 1;
> 
> … doesn’t make the problem go away, for some reason. Replacing it with…
> 
> while (*sp++) ;
> 
> … however *does* make it go away.
> 
> I’ll paste a screenlog of single-stepping through the valgrind version of
> the code below
> (http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/.gdbinit?rev=HEAD has the
> helpful t macro):

does setting __valgrind=1 make the issue disappear?  is the strlen result
correct?


More information about the Gcc-bugs mailing list