]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* tree-ssa-dse.c (compute_trims): Avoid folding away undefined
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Aug 2018 23:43:44 +0000 (23:43 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Aug 2018 23:43:44 +0000 (23:43 +0000)
behaviour.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263793 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-dse.c

index 606fb5f6db5aa9519dd6dc42904d68d9ac9a80ac..f362c36962bec77a4ad0b8b09e469fe7237295b6 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * tree-ssa-dse.c (compute_trims): Avoid folding away undefined
+       behaviour.
+
 2018-08-22  Martin Sebor  <msebor@redhat.com>
 
        PR middle-end/87052
index 4cb8c0f83aca77320fe95a945c5711cb01095925..016aa6cc97c7b5131bbb4c6682a9eb2d0e3beff5 100644 (file)
@@ -248,6 +248,13 @@ compute_trims (ao_ref *ref, sbitmap live, int *trim_head, int *trim_tail,
         residual handling in mem* and str* functions is usually
         reasonably efficient.  */
       *trim_tail = last_orig - last_live;
+
+      /* But don't trim away out of bounds accesses, as this defeats
+        proper warnings.  */
+      if (*trim_tail
+         && compare_tree_int (TYPE_SIZE_UNIT (TREE_TYPE (ref->base)),
+                              last_orig) <= 0)
+       *trim_tail = 0;
     }
   else
     *trim_tail = 0;