[LLVMbugs] [Bug 17793] New: 'this' pointer incorrectly qualified inside of __restrict class member function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 3 16:00:52 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17793

            Bug ID: 17793
           Summary: 'this' pointer incorrectly qualified inside of
                    __restrict class member function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

As Richard Smith mentioned http://llvm.org/bugs/show_bug.cgi?id=17786#c4 we do
not properly handle restrict qualifiers in this case.

This has ABI correctness implications:

#include <typeinfo>
#include <cstdio>

struct S {
  const char *W() {
    return typeid(this).name();
  }
  const char *X() __restrict {
    return typeid(this).name();
  }
  const char *Y() const {
    return typeid(this).name();
  }
  const char *Z() volatile {
    return typeid(this).name();
  }
};

int main() {
  S obj;
  printf("%s\n", obj.W());
  printf("%s\n", obj.X());
  printf("%s\n", obj.Y());
  printf("%s\n", obj.Z());
}


clang:
P1S
Pr1S
PK1S
PV1S

gcc:
P1S
P1S
PK1S
PV1S

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131104/8b26c5ce/attachment.html>


More information about the llvm-bugs mailing list