diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index b10593035c36b0cd09df6f5c281e555b5a2f0f27..58deaf253e93926dfcea5a714597a7d4eb8ae3f4 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -4192,7 +4192,7 @@ bitint_large_huge::lower_addsub_overflow (tree obj, gimple *stmt)
       else
 	{
 	  m_data_cnt = data_cnt;
-	  if (TYPE_UNSIGNED (type0))
+	  if (TYPE_UNSIGNED (type0) || prec0 >= 0)
 	    rhs1 = build_zero_cst (m_limb_type);
 	  else
 	    {
@@ -4210,7 +4210,7 @@ bitint_large_huge::lower_addsub_overflow (tree obj, gimple *stmt)
 		  rhs1 = add_cast (m_limb_type, gimple_assign_lhs (g));
 		}
 	    }
-	  if (TYPE_UNSIGNED (type1))
+	  if (TYPE_UNSIGNED (type1) || prec1 >= 0)
 	    rhs2 = build_zero_cst (m_limb_type);
 	  else
 	    {
diff --git a/gcc/testsuite/gcc.dg/torture/bitint-73.c b/gcc/testsuite/gcc.dg/torture/bitint-73.c
new file mode 100644
index 0000000000000000000000000000000000000000..1e15f3912574f51658b357f5bf89d6a3b791ef08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/bitint-73.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/116501 */
+/* { dg-do run { target bitint575 } } */
+/* { dg-options "-std=c23" } */
+/* { dg-skip-if "" { ! run_expensive_tests }  { "*" } { "-O0" "-O2" } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
+
+_BitInt (4) a;
+
+int
+foo (_BitInt(513) b)
+{
+  return __builtin_sub_overflow_p (a, b, (_BitInt (511)) 0);
+}
+
+int
+main ()
+{
+  if (!foo (0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff0000000000000000wb))
+    __builtin_abort ();
+}