Bug#545834: ivtools: FTBFS: On 64 bit arches: error: cast from 'void*' to 'osboolean' loses precision
On Mon, Sep 28, 2009 at 12:25:56AM +0200, Agustin Martin wrote:
> On Wed, Sep 09, 2009 at 04:51:39PM +0200, Kurt Roeckx wrote:
> > Source: ivtools
> > Version: 1.2.6-1
> > Severity: serious
> > > make[3]: Entering directory `/build/buildd/ivtools-1.2.6/src/Attribute'
> > > installing for LINUX in /build/buildd/ivtools-1.2.6/src/Attribute/LINUX
> > > make[4]: Entering directory `/build/buildd/ivtools-1.2.6/src/Attribute/LINUX'
> > > g++ -gdwarf-2 -O2 -fPIC -Dcplusplus_2_1 -Wno-deprecated -I/build/buildd/ivtools-1.2.6/src/Attribute/LINUX/.. -I/build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../.. -I/build/buildd/ivtools-1.2.6/src -I/build/buildd/ivtools-1.2.6/src/include -I/build/buildd/ivtools-1.2.6/src/include/ivstd -I/usr/include -c /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c
> > > /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c: In member function 'osboolean AttributeValue::boolean_val()':
> > > /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c:360: error: cast from 'void*' to 'osboolean' loses precision
> > > /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c: In member function 'unsigned int AttributeValue::uint_val()':
> > > /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c:519: error: cast from 'void*' to 'unsigned int' loses precision
> > > /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c: In member function 'int AttributeValue::int_val()':
> > > /build/buildd/ivtools-1.2.6/src/Attribute/LINUX/../attrvalue.c:552: error: cast from 'void*' to 'int' loses precision
>
> > Note that a pointer does not fit in an integer on 64 bit arches.
> > A pointer is 64 bit, an integer 32 bit.
>
> This is bug #314666 revisited. Fix proposed there was mostly incorporated
> upstream, but not complete. The part not included by upstream was the
> change of int (and boolean, which seems mapped to int) to long in the
> above lines, so this problem reappears.
>
> I have been playing to build a lenny x86_64 backport (I still use idraw
> frequently). I successfully built the package with gcc 4.3 in a x86_64
> lenny box with attached patch. Instead of changing int and boolean to
> long in offending lines I changed it to intptr_t (and unsigned int to
> uintptr_t), from stdint.h. Seems included by default, so no need of
> explicitly including that header.
>
> I expect it to also build properly in a x86_64 sid box, but cannot check
> now. Since stdint.h is provided by libc6 since some time ago I hope it
> is available in all currently released arches.
intptr_t and uintptr_t are c99 standard types to handle this kind of
things. I think they should already be available in all Debian arches.
> Note that attached patch is only what I used to build the package, so is
> neither tagged as a NMU nor closes the bug. Not sure about the NMU policy
> for QA maintained packages, but if you want me to turn that into a real
> NMU just tell.
Actually I have an NMU ready, in case you want me to upload. diff is
attached.
--
Agustin
diff -wu ivtools-1.2.6/debian/changelog ivtools-1.2.6/debian/changelog
--- ivtools-1.2.6/debian/changelog
+++ ivtools-1.2.6/debian/changelog
@@ -1,3 +1,14 @@
+ivtools (1.2.6-1+nmu1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * 48_gcc40_int_pointer_errors.diff: New patch to fix some gcc40 errors.
+ + A pointer does not fit in an integer on 64 bit arches. A pointer
+ is 64 bit, an integer 32 bit. Use (u)intptr_t instead of
+ (unsigned) int (Closes: #545834).
+ * debian/rules: Remove empty -p parameter to dh_installdocs.
+
+ -- Agustin Martin Domingo <agmartin@debian.org> Tue, 29 Sep 2009 13:02:03 +0200
+
ivtools (1.2.6-1) unstable; urgency=low
* QA upload.
diff -wu ivtools-1.2.6/debian/rules ivtools-1.2.6/debian/rules
--- ivtools-1.2.6/debian/rules
+++ ivtools-1.2.6/debian/rules
@@ -146,7 +146,7 @@
-rm -f $(CURDIR)/debian/libiv-unidraw1/usr/lib/libIV.so.*
#Remove ivmkmf from ivtools-bin package.
-rm -f $(CURDIR)/debian/ivtools-bin/usr/bin/ivmkmf
- dh_installdocs -p
+ dh_installdocs
# dh_installexamples -a
dh_installmenu ivtools-bin
dh_installman -p$(PKG_BIN) -Xsrc/man/man1/ivmkmf.1
diff -wu ivtools-1.2.6/debian/patches/series ivtools-1.2.6/debian/patches/series
--- ivtools-1.2.6/debian/patches/series
+++ ivtools-1.2.6/debian/patches/series
@@ -41,0 +42 @@
+48_gcc40_int_pointer_errors.diff
only in patch2:
--- ivtools-1.2.6.orig/debian/patches/48_gcc40_int_pointer_errors.diff
+++ ivtools-1.2.6/debian/patches/48_gcc40_int_pointer_errors.diff
@@ -0,0 +1,31 @@
+Index: ivtools-1.2.6/src/Attribute/attrvalue.c
+===================================================================
+--- ivtools-1.2.6.orig/src/Attribute/attrvalue.c 2008-02-12 19:38:19.000000000 +0100
++++ ivtools-1.2.6/src/Attribute/attrvalue.c 2009-09-27 23:56:17.000000000 +0200
+@@ -357,7 +357,7 @@
+ case AttributeValue::StringType:
+ return (boolean) int_val()!=-1;
+ case AttributeValue::ObjectType:
+- return (boolean) obj_val();
++ return (intptr_t) obj_val();
+ case AttributeValue::StreamType:
+ return stream_mode() != 0;
+ default:
+@@ -516,7 +516,7 @@
+ case AttributeValue::SymbolType:
+ return (unsigned int) int_val();
+ case AttributeValue::ObjectType:
+- return (unsigned int)obj_val();
++ return (uintptr_t) obj_val();
+ default:
+ return 0;
+ }
+@@ -549,7 +549,7 @@
+ case AttributeValue::SymbolType:
+ return int_ref();
+ case AttributeValue::ObjectType:
+- return (int)obj_val();
++ return (intptr_t) obj_val();
+ default:
+ return 0;
+ }
Reply to: