This is the mail archive of the gcc-patches@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]

zero extend pointer converstions to unsigned long long


The below patch preserves TREE_UNSIGNED on pointers during conversions to int instead of ignoring it.? The outcome of this is to zero extend a pointer instead of sign extend it when converting to a size larger than the pointer.? There is code in layout_type that does:

? ? case POINTER_TYPE:
? ? case REFERENCE_TYPE:
? ? ? {

? ? ? ? enum machine_mode mode = ((TREE_CODE (type) == REFERENCE_TYPE
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? && reference_types_internal)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Pmode : TYPE_MODE (type));

? ? ? ? int nbits = GET_MODE_BITSIZE (mode);

? ? ? ? TYPE_SIZE (type) = bitsize_int (nbits);
? ? ? ? TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (mode));
? ? ? ? TYPE_UNSIGNED (type) = 1;
? ? ? ? TYPE_PRECISION (type) = nbits;
? ? ? }

thus making pointers unsigned.? My patch merely follows that desire.? This patch enables a certain style of kernel programming where the kernel uses unsigned long long values to store user land Pmode values and have all the math come out right.

Ok?

Attachment: conv.diffs.txt
Description: Text document



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