Exemple #1
0
        private IADomain ReadTransfer(ReadStmt readStmt, IADomain domain)
        {
            var newDomain = CopyDomain(domain);

            if (domain.IsBottom())
            {
                return(newDomain);
            }

            var ident = readStmt.Left switch
            {
                VarAccess varAccess => varAccess.Left,
                ArrayAccess arrayAccess => arrayAccess.Left,
                RecordAccess recordAccess => recordAccess.Right,
            };

            if (readStmt.Left is ArrayAccess)
            {
                var ra            = readStmt.Left as ArrayAccess;
                var indexInterval = IAUtil.Arithmetic(ra.Right, domain);
                if (indexInterval.IsBottom)
                {
                    return(Bottom().GetDomain());
                }
            }

            newDomain[ident] = new Interval(ExtendedZ.NegativeInfinity(), ExtendedZ.PositiveInfinity()).ToIntervalK(_program);
            return(newDomain);
        }
Exemple #2
0
        public static ExtendedZ Max(ExtendedZ left, ExtendedZ right)
        {
            if (left.PositiveInf || right.PositiveInf)
            {
                return(ExtendedZ.PositiveInfinity());
            }

            if (left.NegativeInf)
            {
                return(right);
            }

            if (right.NegativeInf)
            {
                return(left);
            }

            return(new ExtendedZ(BigInteger.Max(left.Value, right.Value)));
        }