[patch] Eliminate signed sizetypes (1/3)

Eric Botcazou ebotcazou@adacore.com
Tue Apr 13 09:53:00 GMT 2010


Every compiler in the GNU collection can choose to use either signed or 
unsigned sizetypes (exclusively, mixed signedness isn't allowed); the Ada 
compiler uses signed ones, all the other compilers (including LTO) use 
unsigned ones.  As a consequence, LTO doesn't really work with Ada, even 
intra-language LTO.

So I'm proposing to eliminate signed sizetypes from the middle-end altogether, 
so that people aren't tempted to make the wrong choice anymore :-), switching
the Ada compiler over to unsigned sizetypes in the process.  As a bonus, this 
will also fix bugs in some corner cases for Ada.

The delicate part is converting the Ada compiler because it is still relying 
heavily on subtle overflow handling for sizetypes and flipping the signedness 
changes the semantics.  This dependency should probably be reworked at some 
point, but this won't be easy at all and is not planned yet.

The attached first patch contains changes to the constant folder necessary to 
properly support overflow in unsigned sizetypes; nothing new, this support is 
already there, but it has been slightly damaged, especially by the fix for PR 
middle-end/32628, so the patch undoes it and fixes the problem differently.

The second patch will be the gigi patch and the third patch the one really 
eliminating signed sizetypes from the middle-end.

Tested on x86_64-suse-linux and i586-suse-linux, OK for mainline?


2010-04-13  Eric Botcazou  <ebotcazou@adacore.com>

	PR middle-end/32628
	* c-common.c (pointer_int_sum): Disregard overflow that occured only
	because of sign-extension change when converting to sizetype here...
	* fold-const.c (fold_convert_const_int_from_int): ...and not here.

	* fold-const.c (fold_binary_op_with_conditional_arg): Do not restrict
	the folding to constants.  Remove redundant final conversion.
	(fold_binary) <associate>: Do not associate if the re-association of
	constants alone overflows.
	(fold_binary) <FLOOR_MOD_EXPR>: Move transformation into BIT_AND_EXPR
	to the end of the list.
	(multiple_of_p) <COND_EXPR>: New case.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 9703 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100413/9d466254/attachment.bin>


More information about the Gcc-patches mailing list