https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96814
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- > > diff --git a/gcc/fold-const.c b/gcc/fold-const.c > index 1f861630225..0cc80adf632 100644 > --- a/gcc/fold-const.c > +++ b/gcc/fold-const.c > @@ -12581,7 +12581,9 @@ fold_ternary_loc (location_t loc, enum tree_code > code, t > ree type, > && tree_fits_uhwi_p (op2)) > { > tree eltype = TREE_TYPE (TREE_TYPE (arg0)); > - unsigned HOST_WIDE_INT width = tree_to_uhwi (TYPE_SIZE (eltype)); > + unsigned HOST_WIDE_INT width > + = (TREE_CODE (eltype) == BOOLEAN_TYPE > + ? TYPE_PRECISION (eltype) : tree_to_uhwi (TYPE_SIZE > (eltype))); > unsigned HOST_WIDE_INT n = tree_to_uhwi (arg1); > unsigned HOST_WIDE_INT idx = tree_to_uhwi (op2); > > diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c > index 6d5d65195ae..e9dbe07dccc 100644 > --- a/gcc/tree-vect-generic.c > +++ b/gcc/tree-vect-generic.c > @@ -137,7 +137,7 @@ tree_vec_extract (gimple_stmt_iterator *gsi, tree type, > } > if (bitpos) > { > - if (TREE_CODE (type) == BOOLEAN_TYPE) > + if (0 && TREE_CODE (type) == BOOLEAN_TYPE) > { > tree itype > = build_nonstandard_integer_type (tree_to_uhwi (bitsize), 0); > > > makes the generated code a bit easier to follow but I guess still ends up > miscompiling things? Ok, so apparently you installed already the patch. And yes, we still miscompile it :( > > Note if I add -fdisable-tree-veclower ISEL ICEs. > > So I'd see where this VEC_COND_EXPR comes from. The vector<char> is already build in C FE: #0 build_opaque_vector_type (innertype=<integer_type 0x7ffff75ec2a0 signed char>, nunits=...) at /home/marxin/Programming/gcc/gcc/tree.c:10964 #1 0x000000000082368e in build_binary_op (location=271264, code=GT_EXPR, orig_op0=<compound_literal_expr 0x7ffff741d260>, orig_op1=<integer_cst 0x7ffff75f1078>, convert_p=true) at /home/marxin/Programming/gcc/gcc/c/c-typeck.c:12164 #2 0x00000000008028e3 in parser_build_binary_op (location=271264, code=GT_EXPR, arg1=..., arg2=...) at /home/marxin/Programming/gcc/gcc/c/c-typeck.c:3755 #3 0x000000000084dcfd in c_parser_binary_expression (parser=0x7ffff7fc4ab0, after=<optimized out>, omp_atomic_lhs=<tree 0x0>) at /home/marxin/Programming/gcc/gcc/c/c-parser.c:8087 #4 0x000000000084e9b6 in c_parser_conditional_expression (parser=0x7ffff7fc4ab0, after=<optimized out>, omp_atomic_lhs=<optimized out>) at /home/marxin/Programming/gcc/gcc/c/c-parser.c:7691 #5 0x000000000084efe1 in c_parser_expr_no_commas (parser=0x7ffff7fc4ab0, after=<optimized out>, omp_atomic_lhs=<optimized out>) at /home/marxin/Programming/gcc/gcc/c/c-parser.c:7606 for (gdb) p debug_tree(orig_op0) <compound_literal_expr 0x7ffff741d260 type <vector_type 0x7ffff740ed20 V type <integer_type 0x7ffff75ec348 unsigned char public unsigned QI size <integer_cst 0x7ffff75d3dc8 constant 8> unit-size <integer_cst 0x7ffff75d3de0 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff75ec348 precision:8 min <integer_cst 0x7ffff75d3df8 0> max <integer_cst 0x7ffff75d3d98 255>> unsigned V16QI size <integer_cst 0x7ffff75d3d20 constant 128> unit-size <integer_cst 0x7ffff75d3d38 constant 16> align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff740ec78 nunits:16> side-effects arg:0 <decl_expr 0x7ffff741d240 type <void_type 0x7ffff75ecf18 void VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff75ecf18 pointer_to_this <pointer_type 0x7ffff75f4000>> side-effects arg:0 <var_decl 0x7ffff7fc4bd0 D.4011 type <vector_type 0x7ffff740ed20 V> used unsigned ignored read decl_5 V16QI /home/marxin/Programming/testcases/pr96814.c:8:12 size <integer_cst 0x7ffff75d3d20 128> unit-size <integer_cst 0x7ffff75d3d38 16> align:128 warn_if_not_align:0 context <function_decl 0x7ffff7410200 main> initial <vector_cst 0x7ffff741d220>> /home/marxin/Programming/testcases/pr96814.c:8:12 start: /home/marxin/Programming/testcases/pr96814.c:8:12 finish: /home/marxin/Programming/testcases/pr96814.c:8:12>> $10 = void (gdb) p debug_tree(orig_op1) <integer_cst 0x7ffff75f1078 type <integer_type 0x7ffff75ec5e8 int> constant 0> So the '(V){8} > 0' if I see correctly. I tried to manually change 'intt' in parser_build_binary_op to boolean_type_node, but it leads to: /home/marxin/Programming/testcases/pr96814.c:8:21: error: invalid operands to binary == (have ‘__vector(16) _Bool’ and ‘int’) 8 | x = ((V){8} > 0) == 0; | ~~~~~~~~~~~~ ^~ | | | __vector(16) _Bool :/ Any hint how to resolve it?