tree-vect-generic.c (expand_vector_operations_1): Check optab exists before use it.

gcc/

	* tree-vect-generic.c (expand_vector_operations_1): Check
	optab exists before use it.

gcc/testsuite/

	* g++.dg/pr68062.C: New test.

From-SVN: r229275
This commit is contained in:
Ilya Enkovich 2015-10-23 22:41:40 +00:00 committed by Ilya Enkovich
parent 486208e77a
commit bfccadc924
4 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2015-10-23 Ilya Enkovich <enkovich.gnu@gmail.com>
* tree-vect-generic.c (expand_vector_operations_1): Check
optab exists before use it.
2015-10-23 Ilya Enkovich <enkovich.gnu@gmail.com>
* tree-vect-generic.c (expand_vector_condition): Avoid

View file

@ -1,3 +1,7 @@
2015-10-23 Ilya Enkovich <enkovich.gnu@gmail.com>
* g++.dg/pr68062.C: New test.
2015-10-23 Jeff Law <law@redhat.com>
PR tree-optimization/67830

View file

@ -0,0 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-funsigned-char" } */
typedef char __attribute__ ((vector_size (4))) v4qi;
typedef unsigned char __attribute__ ((vector_size (4))) uv4qi;
v4qi v;
void ret(char a)
{
v4qi c={a,a,a,a};
uv4qi d={a,a,a,a};
v = (c!=d);
}

View file

@ -1533,7 +1533,8 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
&& TYPE_MODE (TREE_TYPE (type)) == TYPE_MODE (TREE_TYPE (srhs1)))
{
op = optab_for_tree_code (code, TREE_TYPE (type), optab_scalar);
if (optab_handler (op, TYPE_MODE (TREE_TYPE (type))) != CODE_FOR_nothing)
if (op != unknown_optab
&& optab_handler (op, TYPE_MODE (TREE_TYPE (type))) != CODE_FOR_nothing)
{
tree slhs = make_ssa_name (TREE_TYPE (srhs1));
gimple *repl = gimple_build_assign (slhs, code, srhs1, srhs2);