Commit 72a7b691c5 for perl
commit 72a7b691c5ca0569771079c1420311a9344bff39
Author: Alin Iacob <alinbsp@gmail.com>
Date: Sat Oct 3 11:18:56 2026 +0300
t/op/bool.t: test boolean cleanup with PERL_NO_COW
Cover both true and false values when appending, undefining and
freeing a scalar. These cases crashed before the fix for GH #19987.
diff --git a/t/op/bool.t b/t/op/bool.t
index 21f6d3b7d5..6bc31dc4b4 100644
--- a/t/op/bool.t
+++ b/t/op/bool.t
@@ -34,4 +34,19 @@ cmp_ok($falsevar, 'eq', "");
cmp_ok($truevar, 'eq', "1");
}
+# GH #19987: these operations crashed with PERL_NO_COW.
+for my $value (0, 1) {
+ my $x = !!$value;
+ $x .= "x";
+ is($x, $value ? "1x" : "x", "append to boolean $value");
+
+ $x = !!$value;
+ undef $x;
+ ok(!defined $x, "undef boolean $value");
+
+ my $a = [!!$value];
+ undef $a;
+ ok(!defined $a, "free boolean $value");
+}
+
done_testing();