--- gcc/cfgexpand.cc.jj	2024-01-03 11:51:28.262776560 +0100
+++ gcc/cfgexpand.cc	2024-01-15 16:08:00.686573778 +0100
@@ -571,6 +571,25 @@ visit_conflict (gimple *, tree op, tree,
   return false;
 }
 
+/* Helper function for add_scope_conflicts_1.  For USE on
+   a stmt, if it is a SSA_NAME and in its SSA_NAME_DEF_STMT is known to be
+   based on some ADDR_EXPR, invoke VISIT on that ADDR_EXPR.  */
+
+static inline void
+add_scope_conflicts_2 (tree use, bitmap work,
+		       walk_stmt_load_store_addr_fn visit)
+{
+  if (TREE_CODE (use) == SSA_NAME
+      && (POINTER_TYPE_P (TREE_TYPE (use)) || ptrofftype_p (TREE_TYPE (use))))
+    {
+      gimple *g = SSA_NAME_DEF_STMT (use);
+      if (is_gimple_assign (g))
+	if (tree op = gimple_assign_rhs1 (g))
+	  if (TREE_CODE (op) == ADDR_EXPR)
+	    visit (g, TREE_OPERAND (op, 0), op, work);
+    }
+}
+
 /* Helper routine for add_scope_conflicts, calculating the active partitions
    at the end of BB, leaving the result in WORK.  We're called to generate
    conflicts when FOR_CONFLICT is true, otherwise we're just tracking
@@ -583,6 +602,8 @@ add_scope_conflicts_1 (basic_block bb, b
   edge_iterator ei;
   gimple_stmt_iterator gsi;
   walk_stmt_load_store_addr_fn visit;
+  use_operand_p use_p;
+  ssa_op_iter iter;
 
   bitmap_clear (work);
   FOR_EACH_EDGE (e, ei, bb->preds)
@@ -593,7 +614,10 @@ add_scope_conflicts_1 (basic_block bb, b
   for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
     {
       gimple *stmt = gsi_stmt (gsi);
+      gphi *phi = as_a <gphi *> (stmt);
       walk_stmt_load_store_addr_ops (stmt, work, NULL, NULL, visit);
+      FOR_EACH_PHI_ARG (use_p, phi, iter, SSA_OP_USE)
+	add_scope_conflicts_2 (USE_FROM_PTR (use_p), work, visit);
     }
   for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
     {
@@ -613,8 +637,7 @@ add_scope_conflicts_1 (basic_block bb, b
 	}
       else if (!is_gimple_debug (stmt))
 	{
-	  if (for_conflict
-	      && visit == visit_op)
+	  if (for_conflict && visit == visit_op)
 	    {
 	      /* If this is the first real instruction in this BB we need
 	         to add conflicts for everything live at this point now.
@@ -634,6 +657,8 @@ add_scope_conflicts_1 (basic_block bb, b
 	      visit = visit_conflict;
 	    }
 	  walk_stmt_load_store_addr_ops (stmt, work, visit, visit, visit);
+	  FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
+	    add_scope_conflicts_2 (USE_FROM_PTR (use_p), work, visit);
 	}
     }
 }
--- gcc/testsuite/gcc.dg/torture/bitint-49.c.jj	2024-01-15 15:13:54.590737604 +0100
+++ gcc/testsuite/gcc.dg/torture/bitint-49.c	2024-01-15 15:14:19.864387438 +0100
@@ -0,0 +1,28 @@
+/* PR tree-optimization/113372 */
+/* { dg-do run { target bitint } } */
+/* { dg-options "-std=c23 -pedantic-errors" } */
+/* { dg-skip-if "" { ! run_expensive_tests }  { "*" } { "-O0" "-O1" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+_BitInt(8) a, b, c;
+
+#if __BITINT_MAXWIDTH__ >= 6384
+_BitInt(8)
+foo (_BitInt(6384) y)
+{
+  _BitInt(4745) x = -(b % y) * b;
+  int i = __builtin_sub_overflow_p (-y, 0, 0);
+  c |= __builtin_add_overflow_p (i, 0, a);
+  return x;
+}
+#endif
+
+int
+main ()
+{
+#if __BITINT_MAXWIDTH__ >= 6384
+  if (foo (4) != 0 || c != 0)
+    __builtin_abort ();
+#endif
+  return 0;
+}
--- gcc/testsuite/gcc.c-torture/execute/pr90348.c.jj	2024-01-15 15:15:24.369493734 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr90348.c	2019-05-07 13:02:47.155066415 +0200
@@ -0,0 +1,38 @@
+/* PR middle-end/90348 */
+
+void __attribute__ ((noipa))
+set_one (unsigned char *ptr)
+{
+  *ptr = 1;
+}
+
+void __attribute__ ((noipa))
+check_zero (unsigned char const *in, unsigned int len)
+{
+  for (unsigned int i = 0; i < len; ++i)
+    if (in[i] != 0)
+      __builtin_abort ();
+}
+
+static void
+set_one_on_stack (void)
+{
+  unsigned char buf[1];
+  set_one (buf);
+}
+
+int
+main ()
+{
+  for (int i = 0; i <= 4; ++i)
+    {
+      unsigned char in[4];
+      for (int j = 0; j < i; ++j)
+	{
+	  in[j] = 0;
+	  set_one_on_stack ();
+	}
+      check_zero (in, i);
+    }
+  return 0;
+}
--- gcc/testsuite/gcc.c-torture/execute/pr110115.c.jj	2024-01-15 15:18:42.327751055 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr110115.c	2024-01-15 15:18:33.094878974 +0100
@@ -0,0 +1,45 @@
+/* PR middle-end/110115 */
+
+int a;
+signed char b;
+
+static int
+foo (signed char *e, int f)
+{
+  int d;
+  for (d = 0; d < f; d++)
+    e[d] = 0;
+  return d;
+}
+
+int
+bar (signed char e, int f)
+{
+  signed char h[20];
+  int i = foo (h, f);
+  return i;
+}
+
+int
+baz ()
+{
+  switch (a)
+    {
+    case 'f':
+      return 0;
+    default:
+      return ~0;
+    }
+}
+
+int
+main ()
+{
+  {
+    signed char *k[3];
+    int d;
+    for (d = 0; bar (8, 15) - 15 + d < 1; d++)
+      k[baz () + 1] = &b;
+    *k[0] = -*k[0];
+  }
+}
--- gcc/testsuite/gcc.c-torture/execute/pr111422.c.jj	2024-01-15 15:21:35.205355850 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr111422.c	2024-01-15 15:21:26.866471388 +0100
@@ -0,0 +1,40 @@
+/* PR middle-end/111422 */
+
+int a, b;
+int *c = &b;
+unsigned d;
+signed char e;
+int f = 1;
+
+int
+foo (int k, signed char *l)
+{
+  if (k < 6)
+    return a;
+  l[0] = l[1] = l[k - 1] = 8;
+  return 0;
+}
+
+int
+bar (int k)
+{
+  signed char g[11];
+  int h = foo (k, g);
+  return h;
+}
+
+int
+main ()
+{
+  for (; b < 8; b = b + 1)
+    ;
+  int j;
+  int *n[8];
+  j = 0;
+  for (;18446744073709551608ULL + bar (*c) + *c + j < 2; j++)
+    n[j] = &f;
+  for (; e <= 4; e++)
+    d = *n[0] == f;
+  if (d != 1)
+    __builtin_abort ();
+}
