aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-low.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-11-10 08:53:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-11-10 08:53:16 +0000
commit67b6981474ce883a419c89fd13d7ae85abf67934 (patch)
tree609f00aaaa86d1c51912ba852cdaaf6424edac1a /gcc/gimple-low.c
parentbf42631e52845de198d2205eb5773d0f37bfcf15 (diff)
downloadgcc-67b6981474ce883a419c89fd13d7ae85abf67934.zip
gcc-67b6981474ce883a419c89fd13d7ae85abf67934.tar.gz
gcc-67b6981474ce883a419c89fd13d7ae85abf67934.tar.bz2
gimple-low.c (lower_function_body): Clear the location of the first inserted representative return if...
* gimple-low.c (lower_function_body): Clear the location of the first inserted representative return if it also fills in for the fallthru. From-SVN: r217278
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r--gcc/gimple-low.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 310ade8..3507d3c 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -129,7 +129,8 @@ lower_function_body (void)
/* If the function falls off the end, we need a null return statement.
If we've already got one in the return_statements vector, we don't
need to do anything special. Otherwise build one by hand. */
- if (gimple_seq_may_fallthru (lowered_body)
+ bool may_fallthru = gimple_seq_may_fallthru (lowered_body);
+ if (may_fallthru
&& (data.return_statements.is_empty ()
|| (gimple_return_retval (data.return_statements.last().stmt)
!= NULL)))
@@ -138,6 +139,7 @@ lower_function_body (void)
gimple_set_location (x, cfun->function_end_locus);
gimple_set_block (x, DECL_INITIAL (current_function_decl));
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
+ may_fallthru = false;
}
/* If we lowered any return statements, emit the representative
@@ -148,6 +150,14 @@ lower_function_body (void)
x = gimple_build_label (t.label);
gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
gsi_insert_after (&i, t.stmt, GSI_CONTINUE_LINKING);
+ if (may_fallthru)
+ {
+ /* Remove the line number from the representative return statement.
+ It now fills in for the fallthru too. Failure to remove this
+ will result in incorrect results for coverage analysis. */
+ gimple_set_location (t.stmt, UNKNOWN_LOCATION);
+ may_fallthru = false;
+ }
}
/* Once the old body has been lowered, replace it with the new