https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118976
--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to avieira from comment #13) > > the VECTOR_CST just goes over the elements in the VECTOR_CST and calls this > recursively, making the change: > --- a/gcc/fold-const.cc > +++ b/gcc/fold-const.cc > @@ -1964,7 +1964,7 @@ const_unop (enum tree_code code, tree type, tree arg0) > if (TREE_CODE (arg0) == INTEGER_CST) > return fold_not_const (arg0, type); > else if (POLY_INT_CST_P (arg0)) > - return wide_int_to_tree (type, -poly_int_cst_value (arg0)); > + return wide_int_to_tree (type, ~poly_int_cst_value (arg0)); > /* Perform BIT_NOT_EXPR on each element individually. */ > else if (TREE_CODE (arg0) == VECTOR_CST) > { > > fixes it for me. > > I'm going on holidays tomorrow, so I'll leave this for someone with a bit > more time to pick up. Richard S it seems to have been your change in: > https://gcc.gnu.org/git/?p=gcc.git;a=commit; > h=36fd64086542ed734aded849304723218fa4d6fd so I'll wait for others to > confirm my thinking here, I always get nervous around bit fiddling ;) Yes that does look like the fix and it looks like obvious and looks like it was just a typo. Though I wonder if we could change fold_not_const to handle it instead. But other than that looks correct.