diff options
author | Alexandre Oliva <oliva@adacore.com> | 2021-12-15 02:22:33 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2021-12-15 02:22:33 -0300 |
commit | c95a9f1ee7ebd461cbced455271a993bae3a42b6 (patch) | |
tree | 524fbd66d186521103aa50ca54adf346236f2e26 /gcc/builtins.c | |
parent | 9c6586bc20ba49d6f42b889936cee0f7563a0966 (diff) | |
download | gcc-c95a9f1ee7ebd461cbced455271a993bae3a42b6.zip gcc-c95a9f1ee7ebd461cbced455271a993bae3a42b6.tar.gz gcc-c95a9f1ee7ebd461cbced455271a993bae3a42b6.tar.bz2 |
[PR100843] store by mult pieces: punt on max_len < min_len
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.
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.
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 03829c0..304d87d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3963,7 +3963,8 @@ try_store_by_multiple_pieces (rtx to, rtx len, unsigned int ctz_len, else if (max_len == min_len) blksize = max_len; else - gcc_unreachable (); + /* Huh, max_len < min_len? Punt. See pr100843.c. */ + return false; if (min_len >= blksize) { min_len -= blksize; |