The original coding was
	var->value = (Datum) state;
which is bogus, and then in commit 
2f0f7b4bce13e68394543728801ef011fd82fac6
it was "corrected" to
	var->value = PointerGetDatum(state);
which is a faithful translation but still wrong.
This seems purely cosmetic, though, so no need for a back-patch.
Pavel Stehule
 }
 
 /* ----------
- * exec_set_found          Set the global found variable
- *                 to true/false
+ * exec_set_found          Set the global found variable to true/false
  * ----------
  */
 static void
    PLpgSQL_var *var;
 
    var = (PLpgSQL_var *) (estate->datums[estate->found_varno]);
-   var->value = PointerGetDatum(state);
+   var->value = BoolGetDatum(state);
    var->isnull = false;
 }