This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 54170


Hi,

On 12/01/2012 07:13 AM, Jason Merrill wrote:
On 11/30/2012 04:05 PM, Paolo Carlini wrote:
@@ -219,10 +219,15 @@ cp_convert_to_pointer (tree type, tree expr, tsubs
-    expr = build_int_cst (type, 0);
+    expr = (TREE_SIDE_EFFECTS (expr)
+        ? build_nop (type, expr)
+        : build_int_cst (type, 0));

This seems to rely on a nop being sufficient to convert from any null pointer constant to the appropriate pointer type, which I don't think is safe if the integer is smaller than a pointer.


I'm also not sure if we want to rely on nullptr_t expressions actually having the value 0.
Thanks a lot. What about the below? I'm consistently building a COMPOUND_EXPR for the simpler plain pointers too; the hunk for pointers to member functions can be *very* simple: in fact I had already tried this solution but something else was wrong yesterday and seemed not to work, huumpf.

Tested x86_64-linux.

Thanks again,
Paolo.

////////////////////

Attachment: patch_54170_2
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]