https://gcc.gnu.org/g:1f372a29808704910b3dfabd1a4f32704be037a8

commit r16-6718-g1f372a29808704910b3dfabd1a4f32704be037a8
Author: Martin Jambor <[email protected]>
Date:   Mon Jan 12 13:32:06 2026 +0100

    ipa-cp: Fix ipa-bit-cp test for recipient_only lattices
    
    Unfortunately I made a silly copy-and paste error in may patch
    introducing the recipient_only flag.  This patch fixes it, correctly
    bailing out in ipa-bit-cp when it is set during propagation.
    
    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.

Diff:
---
 gcc/ipa-cp.cc                       |  2 +-
 gcc/testsuite/gcc.dg/ipa/pr123543.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 54f4e4f543c2..9f61f682d58e 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 000000000000..b3cd4c2bda6a
--- /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(); }

Reply via email to