diff mbox

C++ PATCH for c++/63928 (uninitialized read in constexpr)

Message ID 546CE9E2.6030706@redhat.com
State New
Headers show

Commit Message

Jason Merrill Nov. 19, 2014, 7:05 p.m. UTC
We can't rely on valp continuing to be a pointer into the hash table 
slot.  I fixed that earlier for the store, but forgot to fix the return 
statement as well.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit dfac7dd2d46c5c0f52f6138c68d7e926d90f99be
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Nov 19 19:03:20 2014 +0000

    	PR c++/63928
    	* constexpr.c (cxx_eval_store_expression): Return init, not *valp.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217790 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index d98d9b9..77f5159 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2554,7 +2554,7 @@  cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
   else if (addr)
     return target;
   else
-    return *valp;
+    return init;
 }
 
 /* Evaluate a ++ or -- expression.  */