Hello,

unfortunately I made a silly copy-and paste error in my patch
introducing the recipient_only flag.  This patch fixes it, correctly
bailing out in ipa-bit-cp when it is set during propagation.

I am currently bootstrapping and testing the patch, I will commit the
patch as obvious if it passes.

Sorry for the breakage,

Martin


gcc/ChangeLog:

2026-01-12  Martin Jambor  <[email protected]>

        PR ipa/123543
        * ipa-cp.cc (propagate_bits_across_jump_function): Fix test for
        recipient_only_p.

gcc/testsuite/ChangeLog:

2026-01-12  Martin Jambor  <[email protected]>

        PR ipa/123543
        * gcc.dg/ipa/pr123543.c: New test.
---
 gcc/ipa-cp.cc                       |  2 +-
 gcc/testsuite/gcc.dg/ipa/pr123543.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/pr123543.c

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 54f4e4f543c..9f61f682d58 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -2618,7 +2618,7 @@ propagate_bits_across_jump_function (cgraph_edge *cs, int 
idx,
         and we store it in jump function during analysis stage.  */
 
       if (!src_lats->bits_lattice.bottom_p ()
-         || src_lats->bits_lattice.recipient_only_p ())
+         && !src_lats->bits_lattice.recipient_only_p ())
        {
          if (!op_type)
            op_type = ipa_get_type (caller_info, src_idx);
diff --git a/gcc/testsuite/gcc.dg/ipa/pr123543.c 
b/gcc/testsuite/gcc.dg/ipa/pr123543.c
new file mode 100644
index 00000000000..b3cd4c2bda6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr123543.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+__attribute__((noinline))
+static int local_f(int a, int b) { return a + b; }
+
+__attribute__((noinline))
+int extern_f(int a, int b) { return local_f(a, b); }
+
+int  unused_g1(int b) { return extern_f(0, b); }
+
+int (*volatile fp)(int, int) = extern_f;
+
+int main() { if (fp(1, 2) != 3) __builtin_abort(); }
-- 
2.52.0

Reply via email to