https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178
--- Comment #22 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 6 Apr 2022, amacleod at redhat dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178 > > --- Comment #20 from Andrew Macleod <amacleod at redhat dot com> --- > That is correct. > > tree op1_type = TREE_TYPE (gimple_assign_rhs1 (s)); > tree op2_type = TREE_TYPE (gimple_assign_rhs2 (s)); > tree l = build_int_cst (op2_type, 0); > // C is [0, N), but fortran is [0, N], so default to [0, N]. > tree u = build_int_cst (op2_type, element_precision (op1_type)); > int_range_max shift (l, u); > add_range (gimple_assign_rhs2 (s), shift); > > I build a range for the RHS shift-by operand (op2_type) from 0 to the > precision > of the left operand (op1_type)... THats all we were using op1 for. I was > just under the misimpression that op1 would have a TYPE_PRECISION, not > realizing vectors could be there and they don't set that field. > > I believe that to be correct? Yes. For vector types TYPE_PRECISION is overloaded and specifies log2 of the number of vector elements instead.