+2019-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/89566
+ * gimple-ssa-sprintf.c (sprintf_dom_walker::handle_gimple_call):
+ Set info.fncode to BUILT_IN_NONE if gimple_call_builtin_p failed.
+ Punt if get_user_idx_format succeeds, but idx_format argument is
+ not provided or doesn't have pointer type, or if idx_args is above
+ number of provided arguments.
+
2019-03-04 Wilco Dijkstra <wdijkstr@arm.com>
PR tree-optimization/89437
if (!info.func)
return false;
- info.fncode = DECL_FUNCTION_CODE (info.func);
-
/* Format string argument number (valid for all functions). */
unsigned idx_format = UINT_MAX;
- if (!gimple_call_builtin_p (info.callstmt, BUILT_IN_NORMAL))
+ if (gimple_call_builtin_p (info.callstmt, BUILT_IN_NORMAL))
+ info.fncode = DECL_FUNCTION_CODE (info.func);
+ else
{
unsigned idx_args;
idx_format = get_user_idx_format (info.func, &idx_args);
- if (idx_format == UINT_MAX)
+ if (idx_format == UINT_MAX
+ || idx_format >= gimple_call_num_args (info.callstmt)
+ || idx_args > gimple_call_num_args (info.callstmt)
+ || !POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (info.callstmt,
+ idx_format))))
return false;
+ info.fncode = BUILT_IN_NONE;
info.argidx = idx_args;
}
+2019-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/89566
+ * c-c++-common/pr89566.c: New test.
+
2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84605
--- /dev/null
+/* PR tree-optimization/89566 */
+/* { dg-do compile } */
+
+typedef struct FILE { int i; } FILE;
+#ifdef __cplusplus
+extern "C"
+#endif
+int fprintf (FILE *, const char *, ...);
+
+int
+main ()
+{
+ ((void (*)()) fprintf) (); // { dg-warning "function called through a non-compatible type" "" { target c } }
+ return 0;
+}