https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85257
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 43873 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43873&action=edit gcc8-pr85257.patch Untested fix, actually either of the fold-const.c or tree-ssa-sccvn.c changes is enough to fix this. The fold-const.c change is needed because when using 3 argument native_encode_expr, it is assumed that we return 0 whenever it didn't fit fully, which we violated for VECTOR_CSTs if length was exactly on a boundary between two elements. And the tree-ssa-sccvn.c change is an optimization, there is no reason to compute bytes we aren't interested in, and for larger VECTOR_CSTs like this one because of that not being able to optimize at all; we can use the 4 argument form instead and just compute the bytes we want; in that case the returned length can be just partial of what were asking for, so we need to verify it is enough for what we try to decode.