Commit 444cda74 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/87826 (ubsan: gimple-ssa-store-merging.c:281)

	PR tree-optimization/87826
	* gimple-ssa-store-merging.c (do_shift_rotate): Punt if count is
	negative or larger or equal to type's precision.

	* gcc.dg/pr87826.c: New test.

From-SVN: r265720
parent 86ba9ce6
2018-11-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/87826
* gimple-ssa-store-merging.c (do_shift_rotate): Punt if count is
negative or larger or equal to type's precision.
2018-10-31 Alexandre Oliva <aoliva@redhat.com> 2018-10-31 Alexandre Oliva <aoliva@redhat.com>
* opts.c (default_options_table): Do not enable * opts.c (default_options_table): Do not enable
...@@ -262,7 +262,9 @@ do_shift_rotate (enum tree_code code, ...@@ -262,7 +262,9 @@ do_shift_rotate (enum tree_code code,
int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
unsigned head_marker; unsigned head_marker;
if (count % BITS_PER_UNIT != 0) if (count < 0
|| count >= TYPE_PRECISION (n->type)
|| count % BITS_PER_UNIT != 0)
return false; return false;
count = (count / BITS_PER_UNIT) * BITS_PER_MARKER; count = (count / BITS_PER_UNIT) * BITS_PER_MARKER;
......
2018-11-01 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/87826
* gcc.dg/pr87826.c: New test.
2018-11-01 Thomas Koenig <tkoenig@gcc.gnu.org> 2018-11-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/46020 PR fortran/46020
......
/* PR tree-optimization/87826 */
/* { dg-do compile } */
/* { dg-options "-O3 -w" } */
int c;
void
foo (int *b)
{
int e;
for (e = 0; e < 16; ++e)
b[e] = c >> e * 8;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment