This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] libbanshee seems to be not 64-bit clean



On Sunday, August 17, 2003, at 6:41 AM, Andreas Jaeger wrote:



The following piece of code cannot work correctly IMO:
Actually, it does, except when you have different sized pointers and integers.
If this function didn't work, all hell would break loose.
It's just assigning integers to unique strings.



stamp stamp_string(const char *str) deletes { int st; assert(str_hash != NULL);

  if (! hash_table_lookup(str_hash,(hash_key)str, (hash_data *) &st))
    {
      st = stamp_fresh();
      (void)hash_table_insert(str_hash,(hash_key)str,(hash_data) st);
    }
  return st;
}

hash_data is a pointer.  Daniel, can you look at the code?  I don't
fully understand it so I'm not sure how to fix it properly.

Make the stamps use integers the same size as pointers.
Either that, or have it use pointers to integers (and allocate space for the integers).


Btw. GCC complains about this on a 64-bit platform with:
/cvs/gcc-tree-ssa-20020619-branch/libbanshee/engine/stamp.c:93: warning: cast to pointer from integer of different size


There's a similar warning which can be avoided with some extra
cast, the code itself looks correct - but the function is not used
anywhere, we can remove ptr_hash as far as I can see:

Probably, but libbanshee is an external library, so i'd rather #if 0 it out, than flat out remove it.


/cvs/gcc-tree-ssa-20020619-branch/libbanshee/engine/util.c:177: warning: cast from pointer to integer of different size

Andreas
--
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]