Commit bebe0086 by Martin Liska Committed by Martin Liska

re PR gcov-profile/46266 (gcov generates data for non-existing file <built-in>)

Fix PR gcov-profile/46266

	PR gcov-profile/46266
	* lib/gcov.exp: Verify that <built-in>.gcov file is not
	considered.
	* input.h (RESERVED_LOCATION_P): New macro.
	* profile.c (branch_prob): Use RESERVED_LOCATION_P and
	instread of comparison with UNKNOWN_LOCATION.

From-SVN: r240536
parent b51fe6a9
2016-09-27 Martin Liska <mliska@suse.cz>
PR gcov-profile/46266
* input.h (RESERVED_LOCATION_P): New macro.
* profile.c (branch_prob): Use RESERVED_LOCATION_P and
instread of comparison with UNKNOWN_LOCATION.
2016-09-27 Richard Biener <rguenther@suse.de> 2016-09-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/77745 PR tree-optimization/77745
......
...@@ -61,6 +61,8 @@ extern location_t input_location; ...@@ -61,6 +61,8 @@ extern location_t input_location;
#define LOCATION_BLOCK(LOC) \ #define LOCATION_BLOCK(LOC) \
((tree) ((IS_ADHOC_LOC (LOC)) ? get_data_from_adhoc_loc (line_table, (LOC)) \ ((tree) ((IS_ADHOC_LOC (LOC)) ? get_data_from_adhoc_loc (line_table, (LOC)) \
: NULL)) : NULL))
#define RESERVED_LOCATION_P(LOC) \
(LOCATION_LOCUS (LOC) < RESERVED_LOCATION_COUNT)
/* Return a positive value if LOCATION is the locus of a token that is /* Return a positive value if LOCATION is the locus of a token that is
located in a system header, O otherwise. It returns 1 if LOCATION located in a system header, O otherwise. It returns 1 if LOCATION
......
...@@ -1042,7 +1042,7 @@ branch_prob (void) ...@@ -1042,7 +1042,7 @@ branch_prob (void)
gsi_prev_nondebug (&gsi)) gsi_prev_nondebug (&gsi))
{ {
last = gsi_stmt (gsi); last = gsi_stmt (gsi);
if (gimple_has_location (last)) if (!RESERVED_LOCATION_P (gimple_location (last)))
break; break;
} }
...@@ -1053,7 +1053,7 @@ branch_prob (void) ...@@ -1053,7 +1053,7 @@ branch_prob (void)
is not computed twice. */ is not computed twice. */
if (last if (last
&& gimple_has_location (last) && gimple_has_location (last)
&& LOCATION_LOCUS (e->goto_locus) != UNKNOWN_LOCATION && !RESERVED_LOCATION_P (e->goto_locus)
&& !single_succ_p (bb) && !single_succ_p (bb)
&& (LOCATION_FILE (e->goto_locus) && (LOCATION_FILE (e->goto_locus)
!= LOCATION_FILE (gimple_location (last)) != LOCATION_FILE (gimple_location (last))
...@@ -1262,15 +1262,14 @@ branch_prob (void) ...@@ -1262,15 +1262,14 @@ branch_prob (void)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{ {
gimple *stmt = gsi_stmt (gsi); gimple *stmt = gsi_stmt (gsi);
if (gimple_has_location (stmt)) if (!RESERVED_LOCATION_P (gimple_location (stmt)))
output_location (gimple_filename (stmt), gimple_lineno (stmt), output_location (gimple_filename (stmt), gimple_lineno (stmt),
&offset, bb); &offset, bb);
} }
/* Notice GOTO expressions eliminated while constructing the CFG. */ /* Notice GOTO expressions eliminated while constructing the CFG. */
if (single_succ_p (bb) if (single_succ_p (bb)
&& LOCATION_LOCUS (single_succ_edge (bb)->goto_locus) && !RESERVED_LOCATION_P (single_succ_edge (bb)->goto_locus))
!= UNKNOWN_LOCATION)
{ {
expanded_location curr_location expanded_location curr_location
= expand_location (single_succ_edge (bb)->goto_locus); = expand_location (single_succ_edge (bb)->goto_locus);
......
2016-09-27 Martin Liska <mliska@suse.cz>
PR gcov-profile/46266
* lib/gcov.exp: Verify that <built-in>.gcov file is not
considered.
2016-09-27 Richard Biener <rguenther@suse.de> 2016-09-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/77745 PR tree-optimization/77745
......
...@@ -364,13 +364,20 @@ proc run-gcov { args } { ...@@ -364,13 +364,20 @@ proc run-gcov { args } {
return return
} }
set builtin_index [string first "File '<built-in>'" $result]
if { $builtin_index != -1 } {
fail "$testname gcov failed: <built-in>.gcov should not be created"
clean-gcov $testcase
return
}
# Get the gcov output file after making sure it exists. # Get the gcov output file after making sure it exists.
set files [glob -nocomplain $testcase.gcov] set files [glob -nocomplain $testcase.gcov]
if { $files == "" } { if { $files == "" } {
if { $xfailed } { if { $xfailed } {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
fail "$testname gcov failed: $testcase.gov does not exist" fail "$testname gcov failed: $testcase.gcov does not exist"
clean-gcov $testcase clean-gcov $testcase
return return
} }
......
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