Subject: pkg/34237: news/pan fails to build w/ gcc4 (includes fix)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <martijnb@atlas.ipv6.stack.nl>
List: pkgsrc-bugs
Date: 08/19/2006 17:40:01
>Number:         34237
>Category:       pkg
>Synopsis:       news/pan fails to build w/ gcc4 (includes fix)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 19 17:40:00 +0000 2006
>Originator:     martijnb@atlas.ipv6.stack.nl
>Release:        NetBSD 4.99.1
>Organization:
	
>Environment:
	
	
System: NetBSD atlas.ipv6.stack.nl 4.99.1 NetBSD 4.99.1 (ATLAS) #5: Thu Aug 17 18:52:33 CEST 2006 martijnb@atlas.ipv6.stack.nl:/usr/obj/sys/arch/amd64/compile/ATLAS amd64
Architecture: x86_64
Machine: amd64
>Description:
	news/pan fails to build with gcc4, due to an illegal cast:

cc -DHAVE_CONFIG_H -I. -I. -I../.. -I../..  -I/usr/pkg/include/pan  -DGNOMELOCALEDIR=\""/usr/pkg/share/locale"\"    -I/usr/pkg/include/gtk-2.0 -I/usr/pkg/lib/gtk-2.0/include -I/usr/pkg/include/atk-1.0 -I/usr/pkg/include/cairo -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include -I/usr/pkg/include/freetype2  -pthread -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include  -I/usr/pkg/include/libxml2    -DPNG_NO_ASSEMBLER_CODE -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2  -DPNG_NO_ASSEMBLER_CODE -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2  -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I. -c msort.c
msort.c: In function 'msort_with_tmp':
msort.c:68: error: invalid lvalue in increment
msort.c:69: error: invalid lvalue in increment
msort.c:74: error: invalid lvalue in increment
msort.c:75: error: invalid lvalue in increment
*** Error code 1

Stop.

>How-To-Repeat:
        Try to build news/pan using gcc4
>Fix:
  
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/news/pan/distinfo,v
retrieving revision 1.15
diff -u -r1.15 distinfo
--- distinfo	24 Feb 2005 12:19:55 -0000	1.15
+++ distinfo	19 Aug 2006 17:33:54 -0000
@@ -4,3 +4,4 @@
 RMD160 (pan-0.14.2.tar.bz2) = 0dff24b1d83b6fabfb9cc38a7dea5f9e99513009
 Size (pan-0.14.2.tar.bz2) = 1834784 bytes
 SHA1 (patch-aa) = bfa992f0ad8f2dfcfd1bb9c848ff774bc5cec2b6
+SHA1 (patch-ai) = 3d4f70a9e23f905bf2ff24c87b28539c4abb94bd
Index: patches/patch-ai
===================================================================
RCS file: patches/patch-ai
diff -N patches/patch-ai
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-ai	19 Aug 2006 17:33:54 -0000
@@ -0,0 +1,49 @@
+$NetBSD$
+
+--- pan/base/msort.c.orig	2001-06-18 20:33:38.000000000 +0200
++++ pan/base/msort.c
+@@ -42,6 +42,7 @@ msort_with_tmp (
+ {
+ 	char *tmp;
+ 	char *b1, *b2;
++	unsigned long int *b1_ul, *b2_ul, *tmp_ul;
+ 	size_t n1, n2;
+ 	const int opsiz = sizeof(unsigned long int);
+ 
+@@ -57,24 +58,30 @@ msort_with_tmp (
+ 	msort_with_tmp (b2, n2, s, cmp, t);
+ 
+ 	tmp = t;
+-
+ 	if (s == opsiz && (b1 - (char *) 0) % opsiz == 0)
++	{
+ 		/* operating on aligned words.  Use direct word stores. */
++		b1_ul = (unsigned long int *) b1;
++		b2_ul = (unsigned long int *) b2;
++		tmp_ul = (unsigned long int *) tmp;
++
+ 		while (n1 > 0 && n2 > 0)
+ 		{
+-			if ((*cmp) (b1, b2) <= 0)
++			if ((*cmp) (b1_ul, b2_ul) <= 0)
+ 			{
+ 				--n1;
+-				*((unsigned long int *) tmp)++ =
+-					*((unsigned long int *) b1)++;
++				*tmp_ul++ = *b1_ul++;
+ 			}
+ 			else
+ 			{
+ 				--n2;
+-				*((unsigned long int *) tmp)++ =
+-					*((unsigned long int *) b2)++;
++				*tmp_ul++ = *b2_ul++;
+ 			}
+ 		}
++		b1 = (char *) b1_ul;
++		b2 = (char *) b2_ul;
++		tmp = (char *) tmp_ul;
++	}
+ 	else
+ 		while (n1 > 0 && n2 > 0)
+ 		{

>Unformatted: