[PATCH] Initial support for __sptr and __uptr

Richard Smith richard at metafoo.co.uk
Tue May 14 17:34:20 PDT 2013


On Tue, May 14, 2013 at 4:07 PM, Charles Davis <cdavis5x at gmail.com> wrote:

>
> On May 14, 2013, at 4:26 PM, Aaron Ballman wrote:
> >
> >> Do __sptr and __uptr get different manglings?
> >
> > They do:
> >
> > void func( int * __ptr32 p ) {}
> > void func2( int * __ptr64 p ) {}
> >
> > PUBLIC ?func@@YAXPAH at Z ; func
> > PUBLIC ?func2@@YAXPEAH at Z ; func2
> >
> > Namely, the presence of E (rnk pointed this out previously).
> He was asking about __sptr and __uptr :). They don't by the way:
>
> > cl /c test.cpp
> [extraneous banner output omitted]
> > dumpbin /symbols test.obj
> [...]
> 00F 00000010 SECT4  notype ()    External     | ?func@@YAXPAH at Z (void
> __cdecl func(int *))
> 010 00000020 SECT4  notype ()    External     | ?func2@@YAXPAH at Z (void
> __cdecl func2(int *))


Thanks. One more thing:

template<typename T> void f(void **p, T *q) { *p = *q; }

void *g(int *__ptr32 __sptr a) {
  void *result;
  f(&result, &a);
  return result;
}
void *h(char *__ptr32 __uptr a) {
  void *result;
  f(&result, &a);
  return result;
}

int main() {
  printf("%p\n", g((int *__ptr32 __sptr)0xdeadbeef));
  printf("%p\n", h((char *__ptr32 __uptr)0xdeadbeef));
}

Does one of these get sign-extended and the other one get zero-extended?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130514/1cf5c5ff/attachment.html>


More information about the cfe-commits mailing list