Subject: pkg/26055: Abiword fails to compile on Alpha (64 bit issues)
To: None <gnats-bugs@gnats.netbsd.org>
From: Rhialto <rhialto@azenomei.knuffel.net>
List: pkgsrc-bugs
Date: 06/25/2004 14:30:24
>Number:         26055
>Category:       pkg
>Synopsis:       Abiword fails to compile on Alpha (64 bit issues)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 25 12:31:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Rhialto
>Release:        NetBSD 1.6.2
>Organization:
	
>Environment:
System: NetBSD azenomei.falu.nl 1.6.2 NetBSD 1.6.2 (AZENOMEI) #1: Tue Jun 1 18:15:41 CEST 2004 root@azenomei.falu.nl:/usr/src/sys/arch/alpha/compile/AZENOMEI alpha
Architecture: alpha
Machine: alpha
>Description:
	Compilation of abiword fails thusly (hence Severity:serious, for
	compilation of abiword this is fatal):

source='xap_Draw_Symbol.cpp' object='xap_Draw_Symbol.o' libtool=no \
depfile='.deps/xap_Draw_Symbol.Po' tmpdepfile='.deps/xap_Draw_Symbol.TPo' \
depmode=gcc /bin/sh ../../../../ac-helpers/depcomp \ 
g++ -DPACKAGE_NAME=\"AbiSuite\" -DPACKAGE_TARNAME=\"abisuite\" -DPACKAGE_VERSION=\"2.0\" -DPACKAGE_STRING=\"AbiSuite\ 2.0\" -DPACKAGE_BUGREPORT=\"http://www.abisource.com/\" -DPACKAGE=\"AbiSuite-2.0\" -DVERSION=\"2.0.5\" -DSTDC_HEADERS=1 -DHAVE_LIMITS_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MALLOC_H=1 -DHAVE_LIBXML2=1 -DHAVE_WV=1 -DHAVE_ALLOCA=1 -DRETSIGTYPE=void -DHAVE_REGCOMP=1 -DHAVE_STRDUP=1 -DHAVE_STRSTR=1 -DHAVE_STRCASECMP=1  -I. -I. -I'../.. /../../src/af/util/xp'  -I'../../../../src/af/ev/xp' -I'../../../../src/af/ev/xp' -I'../../../../src/af/gr/xp' -I'../../../../src/af/xap/xp' -I'../../../../src/af/util/unix' -I'../../../../src/af/ev/unix' -I'../../../../src/af/gr/unix' -I'../../../../src/af/xap/unix'  -I'../../../../src/other/spell/xp' -I'../../../../src/other/fribidi/xp' -I'../../../../src/other/ttftool/unix'  -I/usr/pkg/include -I/usr/X11R6/include -I/usr/include -I/usr/pkg/include/freetype2  -O2 -mieee -I/usr/pkg/include -I/usr/X11R6!
/include -I/usr/include -I/usr/pkg/include/freetype2 -Wall -D_BSD_SOURCE -pipe -DNDEBUG -I/usr/pkg/include/libxml2 -I/usr/pkg/include   -I/usr/pkg/include/fribidi -I/usr/pkg/include/wv   -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include -I/usr/include -DHAVE_THREADS=1 -D_REENTRANT -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include    -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/pango-1.0 -I/usr/pkg/include -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/libglade-2.0 -I/usr/pkg/include/libxml2   -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include    -DSUPPORTS_UT_IDLE=1  -DABISUITE_HOME=\"/usr/pkg/share/AbiSuite-2.0\" -DABI_BUILD_VERSION=\"2.0.5\" -c -o xap_Draw_Symbol!
.o `test -f 'xap_Draw_Symbol.cpp' || echo './'`xap_Draw_Symbo!
l.cpp 

xap_Draw_Symbol.cpp: In method `void XAP_Draw_Symbol::draw()':
xap_Draw_Symbol.cpp:156: reinterpret_cast from `const void *' to `UT_uint32' loses precision
xap_Draw_Symbol.cpp: In method `UT_UCSChar XAP_Draw_Symbol::calcSymbolFromCoords(unsigned int, unsigned int)':
xap_Draw_Symbol.cpp:197: reinterpret_cast from `const void *' to `UT_uint32' loses precision
xap_Draw_Symbol.cpp:201: reinterpret_cast from `const void *' to `UT_uint32' loses precision
xap_Draw_Symbol.cpp:201: reinterpret_cast from `const void *' to `UT_uint32' loses precision
xap_Draw_Symbol.cpp: In method `void XAP_Draw_Symbol::calculatePosition(unsigned int, UT_uint32 &, UT_uint32 &)':
xap_Draw_Symbol.cpp:230: reinterpret_cast from `const void *' to `UT_uint32' loses precision
xap_Draw_Symbol.cpp:231: reinterpret_cast from `const void *' to `UT_uint32' loses precision
gmake[4]: *** [xap_Draw_Symbol.o] Error 1
gmake[4]: Leaving directory `/home/tmp/editors/abiword/work.alpha/abiword-2.0.5/abi/src/af/xap/xp'
gmake[3]: *** [all-recursive] Error 1
...


Line 156:

                UT_UCSChar base = static_cast<UT_UCSChar>(reinterpret_cast<UT_uint32>(m_vCharSet[i])); 

Line 197:

                count += reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]);

Line 201:

                        return static_cast<UT_UCSChar>(reinterpret_cast<UT_uint32>(m_vCharSet[i]) + index - count + reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]));

Line 230 - 231:

                UT_uint32 base = reinterpret_cast<UT_uint32>(m_vCharSet[i]);
                UT_uint32 size = reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]);

>How-To-Repeat:
	cd pkgsrc/editors/abiword && make
>Fix:

	Assuming they are indeed storing characters in pointers and not some
	other stupid pointer trick, the following patch should "fix" it:

$NetBSD$

--- abi/src/af/xap/xp/xap_Draw_Symbol.cpp.orig	Fri Jun 25 14:13:25 2004
+++ abi/src/af/xap/xp/xap_Draw_Symbol.cpp	Fri Jun 25 14:24:10 2004
@@ -153,7 +153,7 @@
 	
 	for (i = 0; i < m_vCharSet.size(); i += 2)
 	{
-		UT_UCSChar base = static_cast<UT_UCSChar>(reinterpret_cast<UT_uint32>(m_vCharSet[i]));
+		UT_UCSChar base = static_cast<UT_UCSChar>((UT_uint32)(m_vCharSet[i]));
 		size_t nb_chars = reinterpret_cast<size_t>(m_vCharSet[i + 1]);
 
 		for (UT_UCSChar j = base; j < base + nb_chars; ++j)
@@ -194,11 +194,11 @@
 	UT_DEBUGMSG(("calcSymbolFromCoords(x = [%u], y = [%u]) =", ix, iy));
 	for (size_t i = 0; i < m_vCharSet.size(); i += 2)
 	{
-		count += reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]);
+		count += (UT_uint32)(m_vCharSet[i + 1]);
 		if (count > index)
 		{
 			UT_DEBUGMSG((" %u\n", static_cast<UT_uint32>(reinterpret_cast<UT_uint32>(m_vCharSet[i]) + index - count + reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]))));
-			return static_cast<UT_UCSChar>(reinterpret_cast<UT_uint32>(m_vCharSet[i]) + index - count + reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]));
+			return static_cast<UT_UCSChar>((UT_uint32)(m_vCharSet[i]) + index - count + (UT_uint32)(m_vCharSet[i + 1]));
 		}
 	}
 
@@ -227,8 +227,8 @@
 
 	for (size_t i = 0; i < m_vCharSet.size(); i += 2)
 	{
-		UT_uint32 base = reinterpret_cast<UT_uint32>(m_vCharSet[i]);
-		UT_uint32 size = reinterpret_cast<UT_uint32>(m_vCharSet[i + 1]);
+		UT_uint32 base = (UT_uint32)(m_vCharSet[i]);
+		UT_uint32 size = (UT_uint32)(m_vCharSet[i + 1]);
 		
 		if (base + size > c)
 		{


-Olaf.
-- 
___ Olaf 'Rhialto' Seibert
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.
>Release-Note:
>Audit-Trail:
>Unformatted: