Commit aa67d03c by Jeff Law Committed by Jeff Law

re PR middle-end/82123 (spurious -Wformat-overflow warning for converted vars)

	PR middle-end/82123
	PR tree-optimization/81592
	PR middle-end/79257
	* gimple-ssa-sprintf.c: Include alloc-pool.h, vr-values.h and
	gimple-ssa-evrp-analyze.h
	(class sprintf_dom_walker): Add after_dom_children member function.
	Add evrp_range_analyzer member.
	(sprintf_dom_walker::before_dom_children): Call into the EVRP
	range analyzer as needed.
	(sprintf_dom_walker::after_dom_children): New member function.

	* gcc.dg/builtin-unreachable-6.c: Turn off VRP.

From-SVN: r257852
parent 2db63ab2
......@@ -3,6 +3,13 @@
PR middle-end/82123
PR tree-optimization/81592
PR middle-end/79257
* gimple-ssa-sprintf.c: Include alloc-pool.h, vr-values.h and
gimple-ssa-evrp-analyze.h
(class sprintf_dom_walker): Add after_dom_children member function.
Add evrp_range_analyzer member.
(sprintf_dom_walker::before_dom_children): Call into the EVRP
range analyzer as needed.
(sprintf_dom_walker::after_dom_children): New member function.
* gimple-ssa-evrp-analyze.c (evrp_range_analyzer::enter): Do nothing
if not optimizing.
(evrp_range_analyzer::record_ranges_from_stmt): Likewise.
......
......@@ -80,6 +80,9 @@ along with GCC; see the file COPYING3. If not see
#include "substring-locations.h"
#include "diagnostic.h"
#include "domwalk.h"
#include "alloc-pool.h"
#include "vr-values.h"
#include "gimple-ssa-evrp-analyze.h"
/* The likely worst case value of MB_LEN_MAX for the target, large enough
for UTF-8. Ideally, this would be obtained by a target hook if it were
......@@ -121,10 +124,12 @@ class sprintf_dom_walker : public dom_walker
~sprintf_dom_walker () {}
edge before_dom_children (basic_block) FINAL OVERRIDE;
void after_dom_children (basic_block) FINAL OVERRIDE;
bool handle_gimple_call (gimple_stmt_iterator *);
struct call_info;
bool compute_format_length (call_info &, format_result *);
class evrp_range_analyzer evrp_range_analyzer;
};
class pass_sprintf_length : public gimple_opt_pass
......@@ -3456,7 +3461,7 @@ parse_directive (sprintf_dom_walker::call_info &info,
bool
sprintf_dom_walker::compute_format_length (call_info &info,
format_result *res)
format_result *res)
{
if (dump_file)
{
......@@ -4012,11 +4017,15 @@ sprintf_dom_walker::handle_gimple_call (gimple_stmt_iterator *gsi)
edge
sprintf_dom_walker::before_dom_children (basic_block bb)
{
evrp_range_analyzer.enter (bb);
for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si); )
{
/* Iterate over statements, looking for function calls. */
gimple *stmt = gsi_stmt (si);
/* First record ranges generated by this statement. */
evrp_range_analyzer.record_ranges_from_stmt (stmt, false);
if (is_gimple_call (stmt) && handle_gimple_call (&si))
/* If handle_gimple_call returns true, the iterator is
already pointing to the next statement. */
......@@ -4027,6 +4036,12 @@ sprintf_dom_walker::before_dom_children (basic_block bb)
return NULL;
}
void
sprintf_dom_walker::after_dom_children (basic_block bb)
{
evrp_range_analyzer.leave (bb);
}
/* Execute the pass for function FUN. */
unsigned int
......
2018-02-20 Jeff Law <law@redhat.com>
PR middle-end/82123
PR tree-optimization/81592
PR middle-end/79257
* gcc.dg/builtin-unreachable-6.c: Turn off VRP.
2018-02-20 Jakub Jelinek <jakub@redhat.com>
PR c++/84488
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-fab1 -fno-tree-dominator-opts" } */
/* { dg-options "-O2 -fdump-tree-fab1 -fno-tree-dominator-opts -fno-tree-vrp" } */
void
foo (int b, int c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment