public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9911] middle-end/114681 - condition coverage and inlining
@ 2024-04-11  9:04 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-04-11  9:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:52b63100b1eda433120e726d4e8f8dfca6fc94fa

commit r14-9911-g52b63100b1eda433120e726d4e8f8dfca6fc94fa
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 11 08:47:19 2024 +0200

    middle-end/114681 - condition coverage and inlining
    
    When inlining a gcond it can map to multiple stmts, esp. with
    non-call EH.  The following makes sure to pick up the remapped
    condition when dealing with condition coverage.
    
            PR middle-end/114681
            * tree-inline.cc (copy_bb): Key on the remapped stmt
            to identify gconds to have condition coverage data remapped.
    
            * gcc.misc-tests/gcov-pr114681.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.misc-tests/gcov-pr114681.c | 18 ++++++++++++++++++
 gcc/tree-inline.cc                           |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.misc-tests/gcov-pr114681.c b/gcc/testsuite/gcc.misc-tests/gcov-pr114681.c
new file mode 100644
index 00000000000..a8dc666a452
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-pr114681.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fnon-call-exceptions -fno-exceptions -fcondition-coverage" } */
+
+float f, g;
+
+static void
+bar ()
+{
+  if (g < f)
+    for (;;)
+      ;
+}
+
+void
+foo ()
+{
+  bar ();
+}
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 5f852885e7f..238afb7de80 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -2090,7 +2090,7 @@ copy_bb (copy_body_data *id, basic_block bb,
 	  /* If -fcondition-coverage is used, register the inlined conditions
 	     in the cond->expression mapping of the caller.  The expression tag
 	     is shifted conditions from the two bodies are not mixed.  */
-	  if (id->src_cfun->cond_uids && is_a <gcond*> (orig_stmt))
+	  if (id->src_cfun->cond_uids && is_a <gcond*> (stmt))
 	    {
 	      gcond *orig_cond = as_a <gcond*> (orig_stmt);
 	      gcond *cond = as_a <gcond*> (stmt);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-11  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11  9:04 [gcc r14-9911] middle-end/114681 - condition coverage and inlining Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).