<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 5:49 PM, Florian Weimer via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-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">* James Y. Knight via llvm-dev:<br>
<span class="gmail-"><br>
> To the first, asking people who do crazy stuff like this to compile with<br>
> -fno-strict-overflow is reasonable...they're invoking C-level undefined<br>
> behavior by doing arbitrary pointer-math, so they should use the flag that<br>
> tells the compiler to make arbitrary pointer-math not be UB.<br>
<br>
</span>Bit this comes from a glibc header, so ideally, it should be fixed to<br>
work with all compiler modes (with the caveat that some things that<br>
obstack does may never be valid C code).<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"></div></div></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Yes, no matter what clang does, this header should be fixed to not align pointers an extraneously-weird-and-broken way. On platforms where uintptr_t exists, just do the straightforward obvious math that _everyone else_ uses. On platforms where it doesn't exist (like I guess this IBM thing?), the existing code, path where it subtracts an actual base object is fine...</div><div class="gmail_extra"><br></div><div class="gmail_extra">Also, gotta love this code snippet below. It wants to avoid "polluting the namespace" by including stddef.h (really???), and thus proceeds to define a global macro in the user namespace called "PTR_INT_TYPE". Ha ha very funny!</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span style="font-family:monospace"><span style="color:rgb(0,0,0)">/* We need the type of a pointer subtraction.  If __PTRDIFF_TYPE__ is
</span><br>   defined, as with GNU C, use that; that way we don't pollute the
<br>   namespace with <stddef.h>'s symbols.  Otherwise, include <stddef.h>
<br>   and use ptrdiff_t.  */
<br>
<br>#ifdef __PTRDIFF_TYPE__
<br># define PTR_INT_TYPE __PTRDIFF_TYPE__
<br>#else
<br># include <stddef.h>
<br># define PTR_INT_TYPE ptrdiff_t
<br>#endif<br></span></div></div>