<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 25 May 2018 at 13:34, Hal Finkel via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span class="">
    <p><br>
    </p>
    <div class="m_6348209695862640419moz-cite-prefix">On 05/25/2018 02:40 PM, Richard Smith
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On 25 May 2018 at 12:15, Hal Finkel
            via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF"><span class="m_6348209695862640419gmail-">
                  <p><br>
                  </p>
                  <div class="m_6348209695862640419gmail-m_-7615144704090997817moz-cite-prefix">On
                    05/25/2018 02:01 PM, Friedman, Eli via cfe-dev
                    wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div class="m_6348209695862640419gmail-m_-7615144704090997817moz-cite-prefix">On
                      5/25/2018 11:46 AM, JF Bastien wrote:<br>
                    </div>
                    <blockquote type="cite"> <br>
                      <div><br>
                        <blockquote type="cite">
                          <div>On May 25, 2018, at 11:38 AM, Friedman,
                            Eli <<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>>
                            wrote:</div>
                          <br class="m_6348209695862640419gmail-m_-7615144704090997817Apple-interchange-newline">
                          <div>
                            <div bgcolor="#FFFFFF">
                              <div class="m_6348209695862640419gmail-m_-7615144704090997817moz-cite-prefix">On
                                5/25/2018 11:29 AM, JF Bastien via
                                cfe-dev wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div>
                                  <div>
                                    <ol class="m_6348209695862640419gmail-m_-7615144704090997817MailOutline">
                                      <li>Teach the target
                                        infrastructure that hardware
                                        interference size is something
                                        they can specify (in tablegen
                                        files somewhere).</li>
                                      <li>Allow overriding the value in
                                        sub-targets using -march or
                                        -mcpu (the sub-target defines
                                        the numeric value, and the user
                                        gets the overriden one by using
                                        -march or -mcpu).</li>
                                    </ol>
                                  </div>
                                </div>
                              </blockquote>
                              <br>
                              We can't change the value based on -mcpu. 
                              We generally allow mixing code built with
                              different values of -mcpu.  And any code
                              which is linked together must use the same
                              value for hardware_destructive_interfere<wbr>nce_size,
                              or else we violate ODR.<br>
                            </div>
                          </div>
                        </blockquote>
                        <div><br>
                        </div>
                        <div>Interesting point. The case I’d like to
                          cover is one where the developer wants to get
                          the exact right value for their particular
                          CPU, instead of a conservative answer with
                          extra padding. How do you think we should meet
                          this use case?</div>
                        <br>
                      </div>
                    </blockquote>
                    <br>
                    Go back to the standards committee and ask for a
                    function that isn't constexpr?  I can't think of any
                    other reasonable solution.<br>
                  </blockquote>
                  <br>
                </span> Unfortunately, to define structure layouts they
                need to be constant.<br>
                <br>
                The best solution I've thought of is to extend the
                abi_tag support to force the mangling of interfaces
                depending on values of these constructs to be different.<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>abi_tag is not an effective way of maintaining ABI,
              because it needs to be "viral" / transitive, and can't be
              (at least, not without huge developer effort).</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    Interesting. I had thought that abi_tag was transitive.<br>
    <br>
    It occurs to me that Transitive ABI Infection Mechanism (TAIM) has a
    reasonable acronym. :-) - I suspect that's what we need in this
    case.</div></blockquote><div><br></div><div>That's not possible, because classes can be forward-declared, and you need to know what fields and base classes they have to transitively propagate the taint.</div><div><br></div><div>GCC tries make it possible to transitively propagate the taint manually: they have a warning for a type that uses a tainted type and isn't itself declared with the abi_tag attribute. But in practice (at least for the "C++11 ABI" abi_tag) the taint ends up affecting sufficiently many classes as to make using the attribute that way infeasible to all but the most dedicated.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><span class=""><blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            
            <div>Perhaps we could add an attribute
              to hardware_{con,de}structive_<wbr>interference_size that
              produces a warning if they are used outside the main
              source file?</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    I thought about suggesting this, but didn't, because I suspect that
    many/most uses will be in header files, just project-internal header
    files (because they'll be defining structure layouts, padding
    arrays, etc.). I think that such a warning will be pretty noisy,
    unfortunately.<span class=""><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> We'd also need to make them non-inline, which is an
              observable conformance break, but seems unlikely to be
              important compared to the other issues.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br></span>
    Good point. Do you think that we should file a DR about this? I
    imagine that most everyone is going to be in the same boat in this
    regard.<br></div></blockquote><div><br></div><div>Yes, we probably should. Making them non-inline would presumably mean that we can tell the user it's their fault if the value differs between translation units and they use it in an ODR-relevant context. That doesn't solve the problem, but it does make it not our problem to solve, to a certain extent. We're still left with this being a dangerous feature, but I think that's really unavoidable if we want these things to be compile-time constants.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
     -Hal<span class=""><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF">  -Hal <br>
                <br>
                <blockquote type="cite"><span class="m_6348209695862640419gmail-"> <br>
                    -Eli<br>
                    <pre class="m_6348209695862640419gmail-m_-7615144704090997817moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
                    <br>
                    <fieldset class="m_6348209695862640419gmail-m_-7615144704090997817mimeAttachmentHeader"></fieldset>
                    <br>
                  </span>
                  <pre>______________________________<wbr>_________________
cfe-dev mailing list
<a class="m_6348209695862640419gmail-m_-7615144704090997817moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a class="m_6348209695862640419gmail-m_-7615144704090997817moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a>
</pre>
                </blockquote>
                <span class="m_6348209695862640419gmail-"> <br>
                  <pre class="m_6348209695862640419gmail-m_-7615144704090997817moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
                </span></div>
              <br>
              ______________________________<wbr>_________________<br>
              cfe-dev mailing list<br>
              <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
              <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="m_6348209695862640419moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </span></div>

<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>