tag 570670 patch
thanks

On Sat, Mar 13, 2010 at 12:48:13AM +0100, gregor herrmann wrote:
> On Fri, 12 Mar 2010 22:10:36 +0100, Jozef Kutej wrote:
> 
> > the package builds find on i386 and amd64. In CPAN there is one similar
> > smoketesting test for alpha arch:
> 
> In Debian it fails on alpha and ia64, so something seems fishy:
> 
> https://buildd.debian.org/pkg.cgi?pkg=libunicode-map8-perl
> https://buildd.debian.org/status/package.php?p=libunicode-map8-perl

Here's the backtrace on ia64 (merulo.d.o):

zsh: segmentation fault (core dumped)  PERL_DL_NONLAZY=1 perl -Iblib/lib 
-Iblib/arch t/map8.t

Core was generated by `perl -Iblib/lib -Iblib/arch t/map8.t'.
Program terminated with signal 11, Segmentation fault.
#0  0x20000000062f5220 in XS_Unicode__Map8_recode8 (my_perl=0x6000000000004010, 
cv=0x6000000000074260)
    at Map8.xs:359
359         res[rlen] = '\0';
(gdb) bt
#0  0x20000000062f5220 in XS_Unicode__Map8_recode8 (my_perl=0x6000000000004010, 
cv=0x6000000000074260)
    at Map8.xs:359
#1  0x20000000001d2be0 in Perl_pp_entersub (my_perl=0x6000000000004010) at 
pp_hot.c:2888
#2  0x20000000001cef00 in Perl_runops_standard (my_perl=0x6000000000004010) at 
run.c:40
#3  0x20000000000e8d60 in S_run_body (my_perl=<value optimized out>) at 
perl.c:2431
#4  perl_run (my_perl=<value optimized out>) at perl.c:2349
#5  0x4000000000001290 in main (argc=Cannot access memory at address 
0xc00000000001b516
) at perlmain.c:117

Looks like the problem is that sizeof(STRLEN) != sizeof(int) but
the map8_recode8() call on Map8.xs:358 mixes up pointers to them.

Also, there seems to be a typo in the function prototype in map8.h so
we don't even get a compiler warning. With that fixed, I see

Map8.xs: In function ‘XS_Unicode__Map8_recode8’:
Map8.xs:358: warning: passing argument 6 of ‘map8_recode8’ from incompatible 
pointer type
map8.h:83: note: expected ‘int *’ but argument is of type ‘STRLEN *’

I'm attaching a patch that makes the test pass for me on ia64.

FWIW, this is also [rt.cpan.org #43404] (which contains an identical
patch to mine) and [rt.cpan.org #24652].

It has also failed on amd64 for at least Fedora, see 
 https://bugzilla.redhat.com/show_bug.cgi?id=182514 
-- 
Niko Tyni   nt...@debian.org
>From d8c6831c66b91d0db878ac247d607aa8daec4dcb Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Sat, 20 Mar 2010 23:31:17 +0200
Subject: [PATCH] Fix test failures on 64-bit architectures due to incompatible pointer types

 http://bugs.debian.org/570670
 [rt.cpan.org #43404]
 [rt.cpan.org #24652].
 https://bugzilla.redhat.com/show_bug.cgi?id=182514
---
 Map8.xs |    2 +-
 map8.h  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Map8.xs b/Map8.xs
index 789f921..074ad99 100644
--- a/Map8.xs
+++ b/Map8.xs
@@ -347,7 +347,7 @@ recode8(m1, m2, str)
 	Map8* m2
 	PREINIT:
 	    STRLEN len;
-	    STRLEN rlen;
+	    int rlen;
 	    char*  res;
 	INPUT:
 	    char* str = SvPV(ST(2), len);
diff --git a/map8.h b/map8.h
index 007c5de..98dfb3b 100644
--- a/map8.h
+++ b/map8.h
@@ -80,7 +80,7 @@ void  map8_free(Map8*);
 
 U16*  map8_to_str16(Map8*, U8*, U16*, int, int*);
 U8*   map8_to_str8 (Map8*, U16*, U8*, int, int*);
-U8*   map8_recode_8(Map8*, Map8*, U8*, U8*, int, int*);
+U8*   map8_recode8(Map8*, Map8*, U8*, U8*, int, int*);
 
 int   map8_empty_block(Map8*, U8);
 
-- 
1.7.0

Reply via email to