<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Unions are generally wonky (we even listed them on
    <a class="moz-txt-link-freetext" href="http://clang-analyzer.llvm.org/open_projects.html">http://clang-analyzer.llvm.org/open_projects.html</a>) (see also
    <a class="moz-txt-link-freetext" href="http://lists.llvm.org/pipermail/cfe-dev/2017-March/052881.html">http://lists.llvm.org/pipermail/cfe-dev/2017-March/052881.html</a>).<br>
    <br>
    Additionally, such direct cast from struct rvalue to union rvalue is
    a GCC extension rather than valid C. It shouldn't be hard to
    implement, but it's definitely not on the top of my to-do list.<br>
    <br>
    Your questions indicate to me that you're trying to do something
    weird. I'd much rather try to help with the original problem by
    recommending the overall solution that'll most likely work.<br>
    <br>
    <div class="moz-cite-prefix">On 6/26/19 12:42 PM, Torry Chen via
      cfe-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADmWND-mgeiKO_3d3KiQc2kF9adFuaNw=zrKOpLkG9SsXgHDjA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">My program has struct to union casting and I'm
        writing a checker for some of the union types. One issue I
        noticed is that in checkBind the SVal for the Value part seems
        to be lost (see sample below). Is this a known issue about
        casting to union? How can I get the symbol from the union
        casting assignment (e.g., Val -> conj_$3)?<br>
        <br>
        struct XY {<br>
          uint64_t X;<br>
          uint64_t Y;<br>
        };<br>
        <br>
        union Pos {<br>
          struct XY xy;<br>
        };<br>
        <br>
        // checkBind: Loc -> xy1, Val -> conj_$3{struct XY, LC1,
        S12330, #1}<br>
        struct xy1 = next_pos(12, 13); // implementation of next_pos is
        unknown to CSA<br>
        <br>
        // checkBind: Loc -> pos1, Val -> Unknown<br>
        union Pos pos1 = (union Pos)next_pos(12, 13);<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>