<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><br>
      For the kind of constraint you specified, <font color="#000000"><a
          class="el"
href="http://clang.llvm.org/doxygen/namespaceclang_1_1ento.html#a4e45a121820f0d80d8910093dd33a1df">ProgramStateRef</a>::<a
          class="el"
href="http://clang.llvm.org/doxygen/classclang_1_1ento_1_1ProgramState.html#a046c4b1b381d1f5fed26eda3f0646efb">assumeInBound<font
            color="#000000">() method may also work well.</font></a></font><br>
      <br>
      <br>
      04.06.2016 20:39, Alexey Sidorin via cfe-dev пишет:<br>
    </div>
    <blockquote cite="mid:57531267.9070209@ya.ru" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Hello Raymond,<br>
        <br>
        As I understand, you need to assume <span
          style="font-size:10.0pt;font-family:"Lucida
          Console"">OffsetIsWithinBounds </span>later. I suggest
        you to use another approach. Instead of making a "logical and",
        you can try to just "assume" operands of LAnd sequentially.<br>
        <br>
        So, the first assume will be for <span
          style="font-size:10.0pt;font-family:"Lucida
          Console"">OffsetIsNonNeg</span>, and the next is for <span
          style="font-size:10.0pt;font-family:"Lucida
          Console"">OffsetIsWithinSize.<br>
          <br>
          <br>
        </span><br>
        04.06.2016 00:54, McDowell, Raymond C. via cfe-dev пишет:<br>
      </div>
      <blockquote
        cite="mid:4ae04ad7b35640bfa74e040e5120ca5f@aplex05.dom1.jhuapl.edu"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <meta name="Generator" content="Microsoft Word 14 (filtered
          medium)">
        <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal">I am trying to construct a constraint
            that says 0 <= Offset <= Size, for two SVals Offset
            and Size.  Here’s what I did:<o:p></o:p></p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:10.0pt;font-family:"Lucida
              Console"">  ASTContext &ACtx =
              ChCtx.getASTContext();<o:p></o:p></span></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:10.0pt;font-family:"Lucida
              Console"">  SValBuilder &SVBldr =
              St->getStateManager().getSValBuilder();<o:p></o:p></span></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:10.0pt;font-family:"Lucida
              Console"">  SVal Zero =
              SVBldr.makeZeroVal(ACtx.getSizeType());<o:p></o:p></span></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:10.0pt;font-family:"Lucida
              Console"">  SVal OffsetIsNonNeg =
              SVBldr.evalBinOpNN(St, BO_LE, Zero.castAs<NonLoc>(),
              Offset.castAs<NonLoc>(), ACtx.BoolTy);<o:p></o:p></span></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:10.0pt;font-family:"Lucida
              Console"">  SVal OffsetIsWithinSize =
              SVBldr.evalBinOpNN(St, BO_LE,
              Offset.castAs<NonLoc>(),
              BuffSize.castAs<NonLoc>(), ACtx.BoolTy);<o:p></o:p></span></p>
          <p class="MsoNormal" style="text-autospace:none"><span
              style="font-size:10.0pt;font-family:"Lucida
              Console"">  SVal OffsetIsWithinBounds =
              SVBldr.evalBinOpNN(St, BO_LAnd,
              OffsetIsNonNeg.castAs<NonLoc>(),
              OffsetIsWithinSize.castAs<NonLoc>(), ACtx.BoolTy);<o:p></o:p></span></p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p class="MsoNormal">When I run this code, it fails with an
            error: Assertion `false && “Invalid Opcode.”’
            failed.  This is coming from evalAPSInt in
            BasicValueFactory.cpp.  This function contains a comment
            that says “Land, LOr, Comma are handled specially by
            higher-level logic.”  Land does not seem to be handled by
            higher-level logic in this case.  I intend to work around
            this by asserting these as two separate constraints instead
            of combining them into one.  But this looks like a bug to
            me, so thought I should raise the issue here.<o:p></o:p></p>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
cfe-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>