[PATCH] avoid eliminating live nul stores into strings of bounded length (PR 92226)

Martin Sebor msebor@gmail.com
Mon Oct 28 21:39:00 GMT 2019


A recent enhancement to take advantage of non-constant strlen
results constrained to a known range interacts badly with
the nul-over-nul optimization.  The optimization eliminates
nul stores that overwrite the exiting terminating nul of
the destination string.  This interaction causes the nul
store to be eliminated in subset of cases when it shouldn't
be.

The attached patch fixes the bug by avoiding the optimization
for such destinations.  It also adjusts the comment that
describes the function with the bug to make its return value
clearer.

Tested on x86_64-linux.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-92226.diff
Type: text/x-patch
Size: 7801 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191028/b93c4e6b/attachment.bin>


More information about the Gcc-patches mailing list