From: Edwin Fine Date: 2006-11-24T01:45:05+09:00 Subject: Re: ruby-prof on amd-64? Daniel, As you probably know, most 64-bit processors use the LP64 model (i.e. ints are 32 bits, longs and pointers 64 bits). Many things that people assume are ints on a 32-bit system actually are longs on a 64 bit system. This is why people should really use the C types properly, in other words, size_t for lengths and ptrdiff_t for pointer arithmetic, instead of int. size_t is unsigned on 32-bits, but unsigned long on 64 bits. Also, I think thread ids are 32-bit on 32-bit systems, but 64-bit on 64-bit systems. Look at the type of pthread_t in sys/types.h on your AMD-64 system. So the following code from ruby_prof.c is going to present problems on 64 bit systems: typedef struct { /* Cache hash value for speed reasons. */ st_data_t key; VALUE klass; ID mid; int thread_id; /* Edwin says: should be pthread_t thread_id*/ ... etc ... } Also, this code could be an issue: static inline prof_data_t * stack_push(prof_stack_t *stack) { if (stack->ptr == stack->end) { int len, new_capa; /* Edwin says: Naughty, naughty - should use ptrdiff_t len, not int len*/ len = stack->ptr - stack->start; /* Edwin says: result is actually ptrdiff_t, not int (ptrdiff_t will be unsigned long on LP64)*/ new_capa = (stack->end - stack->start) * 2; REALLOC_N(stack->start, prof_data_t, new_capa); stack->ptr = stack->start + len; stack->end = stack->start + new_capa; } return stack->ptr++; } Judicious changes of int to a suitable portable data type would most likely solve these issues. -- Posted via http://www.ruby-forum.com/.