This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: binutils question


>> 	please see (3) in the first attachment.  when bfd_vma is 64bit and
>> 	host is 32bit, there are problematical typecasts like:
>> 		unsigned long long x;
>> 		void *p;
>> 		x = (unsigned long long)p;
>> 	gcc does not like this as sizeof(p) != sizeof(x).  how should we
>> 	address this problem?  first attachment includes workaround patch,
>> 	assuming that "sizeof(void *) <= sizeof(unsigned long)".  basically
>> 	the patch does the following.
>> 		x = (unsigned long long)(unsigned long)p;
>By "gcc does not like" you mean gcc generates bad code or gives
>fatal errors?  I think it's just a warning that can be ignored.

	warnings.  however, i'm a bit concerned about losing information
	when we typecast.  if the situation was backward - like
	sizeof(void *) > sizeof(long), we will have trouble.  i think
	there needs to be some clarification...

itojun


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