Re: ivtools build failures with gcc40 in 64 bit arches

Agustin Martin <[email protected]> Fri, 11 Dec 2009 17:16:17 +0100
Newsgroups gmane.comp.lib.ivtools.devel
Message-ID <[email protected]>
--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Oct 23, 2009 at 10:15:43AM -0700, Scott Johnston wrote:
> Agustin,
> 
> Does the contents of this patch resolve a compiler error or a
> warning?  Information is still being lost, but if it this fools the
> compiler, I'm fine with that.

Yes, otherwise gcc(>40) will fail in 64 bit arches because of the different
pointer length. I add a modified patch since gcc-4.4.2 complained about
uintptr_t not being available in context. But last Debian gcc-4.2.2 seems to
have some problems, so this may be a compiler problem.

> Casting a pointer to boolean, int, or unsigned int is kind of
> meaningless (other than comparison to NULL), and was only supported
> for debug purposes.

If this is the only purpose, using plain (long) and (unsigned long) 
may even be enough.

Cheers,

-- 
Agustin

--nFreZHaLTZJo0R7j
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="48_gcc40_int_pointer_errors.diff"

Pointer length is different in 32 and 64 bit arches.

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 (unsigned intptr_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;
     }

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ivtools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ivtools-devel

--nFreZHaLTZJo0R7j--