http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59630

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
One alternative could be the following (though completely untested):

--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -14227,6 +14227,10 @@ fold_call_stmt (gimple stmt, bool ignore)
          of a builtin, will use the wrong location information.  */
           if (gimple_has_location (stmt))
                 {
+          tree lhs = gimple_call_lhs (stmt);
+          if (lhs && !useless_type_conversion_p (TREE_TYPE (lhs),
+                             TREE_TYPE (ret)))
+            return NULL_TREE;
           tree realret = ret;
           if (TREE_CODE (ret) == NOP_EXPR)
             realret = TREE_OPERAND (ret, 0);

Reply via email to