<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 01/07/2015 12:05 PM, Matt Arsenault
      wrote:<br>
    </div>
    <blockquote
      cite="mid:8C98EC88-B695-4AB0-94DB-1E3BC62E76AB@gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <br class="">
      <div>
        <blockquote type="cite" class="">
          <div class="">On Jan 7, 2015, at 2:55 PM, Philip Reames <<a
              moz-do-not-send="true"
              href="mailto:listmail@philipreames.com" class="">listmail@philipreames.com</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta content="text/html; charset=utf-8"
              http-equiv="Content-Type" class="">
            <div bgcolor="#FFFFFF" text="#000000" class=""> <br
                class="">
              <div class="moz-cite-prefix">On 01/07/2015 11:52 AM, Matt
                Arsenault wrote:<br class="">
              </div>
              <blockquote
                cite="mid:AB31CCB0-C2EB-47DB-8C12-E657F97527ED@gmail.com"
                type="cite" class="">
                <meta http-equiv="Content-Type" content="text/html;
                  charset=utf-8" class="">
                <br class="">
                <div class="">
                  <blockquote type="cite" class="">
                    <div class="">On Jan 7, 2015, at 2:25 PM, Owen
                      Anderson <<a moz-do-not-send="true"
                        href="mailto:resistor@mac.com" class="">resistor@mac.com</a>>
                      wrote:</div>
                    <br class="Apple-interchange-newline">
                    <div class="">
                      <meta http-equiv="content-type"
                        content="text/html; charset=utf-8" class="">
                      <div dir="auto" class="">
                        <div class="">I'm not aware of any such
                          restriction, and I know of several LLVM based
                          systems that use address space 1 for something
                          other than that.<br class="">
                          <br class="">
                          -Owen</div>
                      </div>
                    </div>
                  </blockquote>
                  <div class=""><br class="">
                  </div>
                  <div class="">Yes, this would be a problem for us. We
                    use 1 for a normal address space where 0 is invalid.
                    However, we also have a problem where some other
                    address spaces do want 0 to be a valid address,
                    which just sort of don’t work correctly now.</div>
                </div>
              </blockquote>
              If you have an example with a null in a non-0 address
              space being mishandled, please file a bug.  We'll fix them
              as we find them.  <br class="">
            </div>
          </div>
        </blockquote>
        <div><br class="">
        </div>
        <div>I think the problems aren’t so much that accessing 0
          doesn’t work (although I imagine there are problems with
          that), but expectations of comparison with null. The main
          problem I’m aware of is comparisons with null pointers. The
          first global object in addrspace(3) will have the address of
          0, so if a user does if (x != NULL), it will not behave as
          expected. For C I think this is supposed to be fixed by
          changing the value of NULL to -1, but I don’t think that is
          currently supported. That is also complicated because the null
          value is different for different address spaces, and I think
          the actual null pointer value must be 0 for C++. It doesn’t
          really turn up often in real code so I don’t think anybody has
          really spent time thinking about how to properly solve this.</div>
      </div>
    </blockquote>
    Just to make sure I'm interpreting this right: the problem is
    essentially that we hard code "null" to mean address 0 in all
    address spaces?  If we allowed the numeric value of null to be
    configurable per address space, would that resolve the issue at the
    LLVM IR level?<br>
    <br>
    Solving the frontend/language spec problem seems out of scope for
    LLVM, though probably not for clang.  Can you point me to a usage of
    C++ with non-zero address spaces?  I'd be curious to know what's
    happening in this space.  <br>
    <br>
    <blockquote
      cite="mid:8C98EC88-B695-4AB0-94DB-1E3BC62E76AB@gmail.com"
      type="cite">
      <div>
        <div><br class="">
        </div>
        <div>-Matt</div>
        <div><br class="">
        </div>
        <br class="">
        <blockquote type="cite" class="">
          <div class="">
            <div bgcolor="#FFFFFF" text="#000000" class="">
              <blockquote
                cite="mid:AB31CCB0-C2EB-47DB-8C12-E657F97527ED@gmail.com"
                type="cite" class="">
                <div class="">
                  <div class=""><br class="">
                  </div>
                  <div class="">-Matt</div>
                  <div class=""><br class="">
                  </div>
                  <div class=""><br class="">
                  </div>
                  <br class="">
                  <blockquote type="cite" class="">
                    <div class="">
                      <div dir="auto" class="">
                        <div class=""><br class="">
                          On Jan 7, 2015, at 1:18 PM, Philip Reames <<a
                            moz-do-not-send="true"
                            href="mailto:listmail@philipreames.com"
                            class="">listmail@philipreames.com</a>>
                          wrote:<br class="">
                          <br class="">
                        </div>
                        <blockquote type="cite" class="">
                          <div class="">
                            <meta http-equiv="content-type"
                              content="text/html; charset=utf-8"
                              class="">
                            On the review for <a moz-do-not-send="true"
                              class="moz-txt-link-freetext"
                              href="http://reviews.llvm.org/D6808">http://reviews.llvm.org/D6808</a>,
                            <a moz-do-not-send="true"
                              href="http://reviews.llvm.org/p/majnemer/"
                              class=" phui-handle phui-link-person ">majnemer</a>
                            commented that:<br class="">
                            <span class="transaction-comment"
                              data-sigil="transaction-comment"
                              data-meta="14_7">"Address space 1 has a
                              special meaning in LLVM, it's identical to
                              address space 0 except for the fact that
                              "null" may be dereferenced. You might want
                              to consider a different address space."<br
                                class="">
                              <br class="">
                              This is the first I've heard of this and I
                              can't find any documentation about it
                              being reserved, either in general, or
                              specifically for x86.  Can anyone clarify?<br
                                class="">
                              <br class="">
                              The only address spaces with special
                              meanings I know of are:<br class="">
                              - 0 (the normal address space, null is not
                              dereferencable)<br class="">
                              - 256 - TLS, GS relative addressing<br
                                class="">
                              - 257 - FS relative addressing<br class="">
                              <br class="">
                              Philip<br class="">
                            </span> </div>
                        </blockquote>
                        <blockquote type="cite" class="">
                          <div class=""><span class="">_______________________________________________</span><br
                              class="">
                            <span class="">LLVM Developers mailing list</span><br
                              class="">
                            <span class=""><a moz-do-not-send="true"
                                href="mailto:LLVMdev@cs.uiuc.edu"
                                class="">LLVMdev@cs.uiuc.edu</a>
                                      <a moz-do-not-send="true"
                                href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a></span><br
                              class="">
                            <span class=""><a moz-do-not-send="true"
                                href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
                                class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span><br
                              class="">
                          </div>
                        </blockquote>
                      </div>
                      _______________________________________________<br
                        class="">
                      LLVM Developers mailing list<br class="">
                      <a moz-do-not-send="true"
                        href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>
                              <a moz-do-not-send="true"
                        href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br
                        class="">
                      <a moz-do-not-send="true"
                        href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
                        class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br
                        class="">
                    </div>
                  </blockquote>
                </div>
                <br class="">
              </blockquote>
              <br class="">
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
    <br>
  </body>
</html>