• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

Revision0bcfd10047731bea91d5a7709d10d8e9177c3826 (tree)
Time2018-04-13 18:24:58
AuthorAldy Hernandez <aldyh@gcc....>
CommiterAldy Hernandez

Log Message

Rewrite size_must_be_zero_p with irange infrastructure.

Rewrite size_must_be_zero_p with irange infrastructure. Previous
implementation did not get the bits in [7fff,ffff]. This fixes a
handful of regressions.

From-SVN: r259370

Change Summary

Incremental Difference

--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -642,9 +642,25 @@ var_decl_component_p (tree var)
642642 static bool
643643 size_must_be_zero_p (tree size)
644644 {
645- return (integer_zerop (size)
646- || (TREE_CODE (size) == SSA_NAME
647- && irange (size).zero_p ()));
645+ if (integer_zerop (size))
646+ return true;
647+
648+ if (TREE_CODE (size) != SSA_NAME)
649+ return false;
650+
651+ tree type = TREE_TYPE (size);
652+ int prec = TYPE_PRECISION (type);
653+
654+ wide_int wone = wi::one (prec);
655+
656+ /* Compute the value of SSIZE_MAX, the largest positive value that
657+ can be stored in ssize_t, the signed counterpart of size_t. */
658+ wide_int ssize_max = wi::lshift (wi::one (prec), prec - 1) - 1;
659+
660+ irange not_zero (type, wone, ssize_max);
661+ irange size_range (size);
662+ return (size_range.contains_p (0)
663+ && size_range.intersect (not_zero).empty_p ());
648664 }
649665
650666 /* Fold function call to builtin mem{{,p}cpy,move}. Try to detect and