[PATCH] D26196: [WIP] Add support for non-zero null pointers

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 14:33:46 PST 2016


efriedma added inline comments.


================
Comment at: lib/CodeGen/CGExprConstant.cpp:1340
+          return C;
+        return getNullPtr(PT, DestType);
       }
----------------
Consider code like the following:

    int x = 0;
    auto y1 = (__specialaddrspace int*)0;
    auto y2 = (__specialaddrspace int*)((void)0, 0);
    auto y3 = (__specialaddrspace int*)x;

How do you expect these three cases to behave?  (The first case involves a C null pointer constant, the second and third cases are different ways of writing a general int->ptr conversion.)


https://reviews.llvm.org/D26196





More information about the cfe-commits mailing list