SEGV from sprintf in a thread #2697
Comments
From hv@hugo.hybyte.comCreated by hv@hugo.hybyte.comHugo% perl -MThread -wl I don't see the same problem on another machine built similarly gdb only seems to know about the main thread in the core dump, Perl Info
|
From [Unknown Contact. See original ticket]In <200010091415.PAA14426@hugo.hybyte.com>, hv@hugo.hybyte.com writes: This appears to have been an optimisation problem: rebuilding perl If time permits I'll try to narrow down the problem region. Hugo |
From [Unknown Contact. See original ticket]In <200010091654.RAA07052@hugo.hybyte.com>, hv@hugo.hybyte.com writes: Ah, no. It is a -DDEBUGGING problem: PL_efloat{buf,size} are wrongly I think the attached patch puts the fix in the right place. I haven't I think this patch should be suitable for both 5.6.1 and 5.7.x. Hugo Inline Patch--- util.c.old Wed Mar 22 15:19:01 2000
+++ util.c Tue Oct 10 13:53:32 2000
@@ -3479,6 +3479,8 @@
PL_dirty = 0;
PL_localizing = 0;
Zero(&PL_hv_fetch_ent_mh, 1, HE);
+ PL_efloatbuf = (char*)NULL;
+ PL_efloatsize = 0;
#else
Zero(thr, 1, struct perl_thread);
#endif
--- t/lib/thr5005.t.old Wed Mar 22 14:43:18 2000
+++ t/lib/thr5005.t Tue Oct 10 14:03:04 2000
@@ -13,7 +13,7 @@
$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
}
$| = 1;
-print "1..21\n";
+print "1..22\n";
use Thread 'yield';
print "ok 1\n";
@@ -89,6 +89,18 @@
my $longe = " short.";
my $thr1 = new Thread \&threaded, $short, $shorte, "19";
my $thr2 = new Thread \&threaded, $long, $longe, "20";
+my $thr3 = new Thread \&testsprintf, "21";
+
+sub testsprintf {
+ my $testno = shift;
+ # this may coredump if thread vars are not properly initialised
+ my $same = sprintf "%.0f", $testno;
+ if ($testno eq $same) {
+ print "ok $testno\n";
+ } else {
+ print "not ok $testno\t# '$testno' ne '$same'\n";
+ }
+}
sub threaded {
my ($string, $string_end, $testno) = @_;
@@ -115,4 +127,5 @@
}
$thr1->join;
$thr2->join;
-print "ok 21\n";
+$thr3->join;
+print "ok 22\n"; |
Migrated from rt.perl.org#4412 (status was 'resolved')
Searchable as RT4412$
The text was updated successfully, but these errors were encountered: