On 12/9/2021 3:16 PM, Alexandre Oliva via Gcc-patches wrote:
The testcase confuses the code that detects min and max len for the
memset, so max_len ends up less than min_len.  That shouldn't be
possible, but the testcase requires us to handle this case.

The store-by-mult-pieces algorithm actually relies on min and max
lengths, so if we find them to be inconsistent, the best we can do is
punting.

Regstrapped on x86_64-linux-gnu.  Ok to install?


for  gcc/ChangeLog

        PR middle-end/100843
        * builtins.c (try_store_by_multiple_pieces): Fail if min_len
        is greater than max_len.

for  gcc/testsuite/ChangeLog

        PR middle-end/100843
        * gcc.dg/pr100843.c: New.
The patch is clearly safe.  My question is should we have caught this earlier in the call chain?  If so, I'd prefer to fix it there and leave the gcc_unreachable in place to catch other bogus cases that may get into try_store_by_multiple_pieces.


Jeff

Reply via email to