[Bug tree-optimization/85257] [6/7/8 Regression] wrong code with -O -fno-tree-ccp and reading zeroed vector member
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85257 --- Comment #3 from Jakub Jelinek --- Author: jakub Date: Sat Apr 7 07:20:42 2018 New Revision: 259206 URL: https://gcc.gnu.org/viewcvs?rev=259206=gcc=rev Log: PR tree-optimization/85257 * fold-const.c (native_encode_vector): If not all elts could fit and off is -1, return 0 rather than offset. * tree-ssa-sccvn.c (vn_reference_lookup_3): Pass (offseti - offset2) / BITS_PER_UNIT as 4th argument to native_encode_expr. Verify len * BITS_PER_UNIT >= maxsizei. Don't adjust buffer in native_interpret_expr call. * gcc.dg/pr85257.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr85257.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-sccvn.c
[Bug tree-optimization/85257] [6/7/8 Regression] wrong code with -O -fno-tree-ccp and reading zeroed vector member
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85257 --- Comment #2 from Jakub Jelinek --- Created attachment 43873 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43873=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.
[Bug tree-optimization/85257] [6/7/8 Regression] wrong code with -O -fno-tree-ccp and reading zeroed vector member
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85257 Jakub Jelinek changed: What|Removed |Added Priority|P3 |P2 Status|UNCONFIRMED |NEW Last reconfirmed||2018-04-06 CC||jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Target Milestone|--- |6.5 Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek --- Started with r213045. I'll have a look.